Page 1 of 2
PIC18F67K40 UART Baud rate 7bit mode ?
Posted: Fri Apr 02, 2021 6:49 am
by seokgi
Hello!
I am making a communication converter using PIC18F67K40. But there are many problems. SendString is doing fine for your help last time. However, if an external clock is used, the communication does not work correctly. And 2400 baud rate 7bit mode does not work. recive interrup seems to work fine. It works well in HS Osilator, HFINT OSC with HFFRQ =64Mhz, 9600, 8,1 mode.
Please help.
Thank you.
Re: PIC18F67K40 UART Baud rate 7bit mode ?
Posted: Tue Apr 06, 2021 6:32 am
by seokgi
Somebody Help me!
I need any hint.
Thank you.
Re: PIC18F67K40 UART Baud rate 7bit mode ?
Posted: Tue Apr 06, 2021 8:19 am
by LeighM
Can you first check that your "external clock" is working, and you get the correct speed, by doing a simple "1 second LED flash test" program?
If that works, could you then transmit from the UART and check the baud rate?
Re: PIC18F67K40 UART Baud rate 7bit mode ?
Posted: Tue Apr 06, 2021 10:31 am
by seokgi
As mentioned above, I checked everything. However, it does not work well if you use an external clock. If you check with the oscilloscope, the clock is working well.
External clocks were used at 11.0592, 18.432, 22.1184, and 16 MHz.
Re: PIC18F67K40 UART Baud rate 7bit mode ?
Posted: Tue Apr 06, 2021 11:17 am
by LeighM
does not work well
...what does that mean?
Re: PIC18F67K40 UART Baud rate 7bit mode ?
Posted: Tue Apr 06, 2021 11:29 am
by seokgi
If an external clock is used, the serial communication characters are broken.
Re: PIC18F67K40 UART Baud rate 7bit mode ?
Posted: Tue Apr 06, 2021 11:38 am
by LeighM
OK, thanks.
So you are getting something, but perhaps at the wrong speed?
Could you put an oscilloscope on the Tx output and determine what the baud rate is versus what you expect?
Also timing the flash of a LED, say at 1/2 second on and off, or other output, will tell us if the processor is running at the speed Flowcode expects it to be running.
If you could give us more information like this it will help us narrow down the issue.
Presumably you are setting the changed clock speed in the project settings?
Re: PIC18F67K40 UART Baud rate 7bit mode ?
Posted: Wed Apr 07, 2021 5:05 am
by seokgi
This is a screen measured with an oscilloscope.
Only 7bit mode cannot be read.
Re: PIC18F67K40 UART Baud rate 7bit mode ?
Posted: Wed Apr 07, 2021 8:52 am
by LeighM
Thanks for that.
Would you mind please doing another test?
Just to confirm, your issue is with 7 bit UART at 2400 baud?
If so, could you create a simple program that does the UART initialisation,
then goes into a continuous loop that delays for 10mS and sends character 'U'
Then post the oscilloscope trace for that?
Thanks
Re: PIC18F67K40 UART Baud rate 7bit mode ?
Posted: Wed Apr 07, 2021 9:53 am
by LeighM
Hi,
If the baud rate is OK, the next problem is that this device does not directly support 7 bit UART operation.
One possibility is to set bit 7 high for each byte before you send it.
Similarly each received byte will have bit 7 set.
This is assuming that the sender transmits with at least 2 stop bits.