[Dprglist] STM32 software uart
deltagraph at aol.com
deltagraph at aol.com
Fri May 8 18:41:38 PDT 2020
David,
It has been some time since I have written a software UART, (ack 15 years) but I do remember a handy diagnostic technique that I employed which is to generate a brief pulse on a GPIO pin when sampling each data bit and also a pulse when recognizing a start bit which I typically performed with an edge triggered interrupt. This pulse was used to trigger and oscilloscope and the sample pulses were overlaid with the data stream on the scope display. I never sampled more that one time within a bit time on anything I ever wrote, but of course that might be an option.
I assume some of your devices have a low data rate, e.g. 9600 baud. Higher baud rates can be tough to deal with. I can't remember if I ever used a dedicated timer, but that might prove very effective in being able to accurately time pulses as long as you can get around logging counts within a single bit time of your data stream. I would think polling would fail before timer input capture as far as problems with interrupt latency...
Of course for transmission using a timer is real handy since with output compare register and interrupts you can synthesize "exact" bit timings provided your timer has the needed prescaler. I guess that is the nice thing about modern 32 bit MCUs, real nice ability to program the frequency you want.
Ron Grant
-----Original Message-----
From: David Anderson via DPRGlist <dprglist at lists.dprg.org>
To: dprglist at lists.dprg.org
Sent: Wed, May 6, 2020 10:46 pm
Subject: [Dprglist] STM32 software uart
Hello DPRG,
As discussed in Tueday's RBNO, I'm trying to port my jBot code to the
STM32F411RE and have run out of UARTS. I need 5 and the board only
supports 3 in hardware (USART1, USART2, USART6). So I was looking at
adding another CPU, a teensy, and using SPI or I2C for comm between the
two boards.
I found several software uarts but all were for sale. Turns out I
didn't look hard enough. There is a free one available from ST Micros
it self: stsw-stm3156. It requires an available timer, which I think
I have, and a couple of free GPIO pins. I've downloaded the sofware
and docs and am cautiously optimistic...
dpa
_______________________________________________
DPRGlist mailing list
DPRGlist at lists.dprg.org
http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dprg.org/pipermail/dprglist-dprg.org/attachments/20200509/5078c1eb/attachment.html>
More information about the DPRGlist
mailing list