[TODO] Interrupt-driven UART Driver for STM32F05x

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

[TODO] Interrupt-driven UART Driver for STM32F05x

Post by steved »

I'm using both serial ports in UART mode on the 32F051, plus one or both I2C ports - so not enough DMA controllers to go round.

I'm only using serial at 9600 baud, so added a compile-time option to the UART driver so that it could be interrupt-driven rather than use DMA.

Use the attached to replace the standard STM32/UARTv2 files, and for interrupt-driven handlers add in mcuconf.h:

#define STM32_UART_USE_INTERRUPTS TRUE

(if not defined, the driver defaults to DMA for BC)
Attachments
USARTv2.zip
Unzip in platforms/STM32 directory
(19.91 KiB) Downloaded 840 times
goeck
Posts: 92
Joined: Mon Feb 11, 2013 12:00 pm

Re: Interrupt-driven UART Driver for STM32F05x

Post by goeck »

uh...nice. Please add this to trunk. I'm not able to test it extensively though now ...
Also I'd like to have that option for I2C and SPI...this is the usual case on AVR, where no DMA is present.

Cheers
Stefan
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Re: [TODO] Interrupt-driven UART Driver for STM32F05x

Post by steved »

Updated version for 3.x attached
Attachments
USARTv2.zip
(7.92 KiB) Downloaded 759 times
colin
Posts: 149
Joined: Thu Dec 22, 2011 7:44 pm

Re: [TODO] Interrupt-driven UART Driver for STM32F05x

Post by colin »

Thanks steved, I am glad to see this. I hope to see, or possibly write myself, interrupt-driven options for SPI and I2C on the STM32F0 as well, since I want to use two SPI and two I2C concurrently for a project.
colin
Posts: 149
Joined: Thu Dec 22, 2011 7:44 pm

Re: [TODO] Interrupt-driven UART Driver for STM32F05x

Post by colin »

steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Re: [TODO] Interrupt-driven UART Driver for STM32F05x

Post by steved »

colin wrote:Oh yeah, actually someone has developed an interrupt-driven I2C driver for STM32F0 already

Unfortunately looks like that one is for the STM32F1, unless I've missed something. (I'd noted it as a possible basis for a 32F0 version).
I did start on an interrupt-driven I2C driver, without total success; some of what I was trying to achieve is covered in this thread
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: [TODO] Interrupt-driven UART Driver for STM32F05x

Post by DeusExMachina »

steved wrote:I'm using both serial ports in UART mode on the 32F051, plus one or both I2C ports - so not enough DMA controllers to go round.

I'm only using serial at 9600 baud, so added a compile-time option to the UART driver so that it could be interrupt-driven rather than use DMA.

Use the attached to replace the standard STM32/UARTv2 files, and for interrupt-driven handlers add in mcuconf.h:

#define STM32_UART_USE_INTERRUPTS TRUE

(if not defined, the driver defaults to DMA for BC)


Great job! I used it and it works as expected. Thank you.
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: [TODO] Interrupt-driven UART Driver for STM32F05x

Post by mobyfab »

Why don't you use the serial driver which uses interrupts?
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: [TODO] Interrupt-driven UART Driver for STM32F05x

Post by DeusExMachina »

I have a byte-oriented protocol, so it's easier to manipulate the input data using UART driver.
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Re: [TODO] Interrupt-driven UART Driver for STM32F05x

Post by steved »

Driver also now tested on the 32F302.
Post Reply