Jump to content

Serial_test.c Baud Rate Change


Recommended Posts

Now that I have serial_test example running (thanks Dave) I find that changing the bit_rate defined in main doesn't change the baud rate when I program the chip with the new .hex file.

 

Now what have I screwed up?

Link to post
Share on other sites

ryeg,

Now that I have serial_test example running (thanks Dave) I find that changing the bit_rate defined in main doesn't change the baud rate when I program the chip with the new .hex file.

 

Now what have I screwed up?

You haven't rebuilt the project or haven't reloaded the new .hex file into your programming software I would guess, so you are programming with the old code.

 

Regards

Dave

Link to post
Share on other sites
ryeg,
Now that I have serial_test example running (thanks Dave) I find that changing the bit_rate defined in main doesn't change the baud rate when I program the chip with the new .hex file.

 

Now what have I screwed up?

You haven't rebuilt the project or haven't reloaded the new .hex file into your programming software I would guess, so you are programming with the old code.

 

Regards

Dave

 

If you use the h/w UART you have to change parameters in uart_init function, the bit_time is irrelevant in this case.

Link to post
Share on other sites

It must be something I don't understand about the compiler...

I build example serial_test with bit_time defined at one rate and then rename the serial_test.hex file to ref.hex.

 

Then I change the bit_time define to a much larger new number and build again getting a new serial_test.hex file.

 

Then I do a DOS FC and COMP on the two files and they both still look the same.

 

I thought that bit_time might be defined again elsewhere in the code but couldn't find it.

 

Is there a hot key for find? or a find again function?

 

Otherwise I am having fun.

 

Thanks for your help and patience.

 

Ryeg

Link to post
Share on other sites

More data on the bit_time problem in the serial_test program

 

I commented out the define and put bit_time in as a volatile int. Got a change in code size and could see (same) bit width on scope. Then changed value of bit_time and still get the same bit width on the scope.

 

Just in case it was a programmer problem, I loaded a known good program, tested it, and then reloaded serial_test successfully.

 

Thanks for your help.\

 

Rye

Link to post
Share on other sites

SOLVED

The example program covers both hardware and software USARTs. The bit_time define that I was manipulating sets the software baudrate. Since it appears as if the Hardware UART is being used, the hardware baudrate is set down in main() as part of the uart_init function.

 

I'm still not sure what sets the test for HW or SW, but I will wade thru the code and am sure I will find it.

 

As a helpful (constructive) aside, I think that the examples provided are sometimes a bit more complicated for the new user that they might be. A really simple Hello World might be helpful.

 

I find that if I bang my head against the wall enough I finally discover the answer.... pass the asprin.

Link to post
Share on other sites
As a helpful (constructive) aside, I think that the examples provided are sometimes a bit more complicated for the new user that they might be.  A really simple Hello World might be helpful.

 

But how do you output HelloWorld without a serial port or an LCD?

 

I find that if I bang my head against the wall enough I finally discover the answer.... pass the asprin.

 

Hey, stop giving away professional secrets!

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...