FC11 Software UART Bit Timing?

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
jay_dee
Posts: 250
http://meble-kuchenne.info.pl
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 99 times
Been thanked: 68 times

Flowcode v11 FC11 Software UART Bit Timing?

Post by jay_dee »

Hi,
PIC18F2585 20MHz Xtal. Running latest updates.
Issues with UART, OK in hardware mode but will not run anything above 9600 in software mode. I usually can run 19200 without issues.
Bit timing looks wrong. getting around 22Khz for a 19600 setting.
I checked a LED flash at 10hz on scope, good. but a 100 uS pulse is showing around 106uS on scope.

I also had issues getting the software output to assign to the correct pin but I think this was resolved with the latest FC11 update.
I'm fairly used to using this PIC and UART so I dont think its something dumb on my side... yet!

BenR
Matrix Staff
Posts: 2027
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 537 times
Been thanked: 721 times

Re: FC11 Software UART Bit Timing?

Post by BenR »

Hello,

The software UART has not changed between v10 and v11 so it could be interrupts or maybe the clock speed setting in the project options that's causing the problems. As you stated the flasher looks ok when running slow then that rules out a clock speed issue.

If it's just a standard UART that you want then I highly recommend the UART Software (Timer) component available from Comms. This uses a timer interrupt to drive the UART functionality on a regular tick and is much more reliable then the software only method. It also has additional buffers so you can reliably TX/RX data without much effort.

There's an example here.
https://www.flowcode.co.uk/wiki/index.p ... Interface)

If it's a component built on top of the UART you need then let us know what it is. I have on my list the ability to add the timer interrupt and buffering options to the standard UART but finding the best way to do it universally is tricky.

jay_dee
Posts: 250
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 99 times
Been thanked: 68 times

Re: FC11 Software UART Bit Timing?

Post by jay_dee »

Hi Ben,
Please move this to another Forum section if its no longer a bug issue. thanks, J.

FOsc 20MHz, HS Mode. No PLL.
I'm 95% sure clock is correct as this also clocks the hardware UART with No issues.
I measure these values on the scope when using the Hardware UART. All of these Work Great and are read fine by a terminal program.
UART / Scoped Rate
9600 / 9708
19200 / 19231
38400 / 38168
57600 / 56948
115200 / 113900
Using the Software mode of UART 1 gives screwy values above 9600.
Software / Scoped
9600 / 9980
19200 / 25253
Using the Interupt method you describe. I also give the PreScaler, PostScaler and RollOver Values Used.
The FC calulated Timer2 Interrupt values look great but the measured baud values with the scope are some way off.
Timer UART / FC Calculated / Scoped / Pre / Post /RollOver
9600 / 9615 / 9487 :1 :4 :130
19200 / 19230 / 18727 :1 :2 :130
38400 / 38461 / 36630 :1 :1 :130
57600 / 57471 / 53248 :1 : :187
This is the stripped out basic FC i'm using for tests.
FC11_PIC18F2585_Timer_UART_WIP.fcfx
(18.22 KiB) Downloaded 6 times
I'm now going to run a bench test, toggling an output using the Interupt timer, to test this function. J.

Post Reply