[GreenKeys] UART (sort of like) in software on Arduino

Harold Hallikainen harold at w6iwi.org
Sun Dec 12 13:01:03 EST 2021



On Sun, December 12, 2021 7:06 am, steve bennett via GreenKeys wrote:
> Forgive me if I am repeating myself but my last last post never showed up
> as far as I can tell.
> 45.45 UARTs seem to be harder to come by than they used to be.Here is my
> suggestion for making your own in Software.

I think the UART in most microcontrollers can hit 45.45 bps. For example,
the Microchip PIC32 can do it, as described at
https://ww1.microchip.com/downloads/en/DeviceDoc/60001107H.pdf#page=13 .
To hit 45.45 bps, BRGH=0, BRG=55004, with a peripheral bus frequency of 40
MHz.
The resulting bit rate is .003% high.

HOWEVER, this chip can only do 8 or 9 bits; odd, even, or no parity; and 1
or two stop bits. This would be ok on transmit if we just set the most
significant bits to 1 simulating a long stop bit or delay between
characters. To get 22 ms per bit with a 31 ms stop, it looks like we would
indeed have to go to a bit-banged software UART.

It would be possible to do this with software delay loops, but then the
code blocks while transmitting or receiving characters. I think a timer
interrupt driving a state machine for transmission and reception should be
used.

I used this technique to receive 0.5 bps serial data where a white cinema
screen was mark, and black was space. An ASCII text sequence is sent to
start a test script that measures the screen luminance, chromaticity, and
auditorium sound pressure level. This was done with a PIC32 (
https://www.qsc.com/cinema/products/test-and-measurement/lss-200/ ).

There's the book "All I Really Need To Know I Learned In Kindergarten."
For me, all I really needed to know I learned in high school messing with
Teletypes. Teletype introduced me to the UART concept, frequency shift
keying, and more. I used that to design a lot of products over 50 years.

Harold
https://w6iwi.org




More information about the GreenKeys mailing list