ST ARM Cortex M-3 (Olimex board)

Hi everybody, just to clarify i have not much experience (my first ucontroller was an arduino and i just jump to ARM, sound like a joke :P).

Anyway i been 3 days studying the data sheet and im using the Keil uVision, now i able to control the pins, serial port, interrupts, system Ticks, analog inputs, (letter with I2c and etc.)…

Well the problem is that i don’t know exactly how receive data through the serial port efficiently… (is not like arduino that you have a buffer and just request the data and that its, and sorry for the example)…

So im using a TX interrupt to store just a single byte on the buffer, but the problem is that i can only read one byte for interrupt, i thought that the USART usually have an internal buffer (controlled automatically by hadware, but not), i mean seems that i need to do it by myself… Any idea or example, to make a nice buffer for the USART and just read and store a complete string of bytes at a time a not just a single one??

Yes i know how to deal with flags… =)

Thanks… :roll:

The USART should have a single buffer register and the shift register.

I don’t know if this can help you, I just wrote a STM32 demo for my project, it includes a serial driver with circular queues and all. The link is in my signature.

Giovanni

gdisirio:
The USART should have a single buffer register and the shift register.

I don’t know if this can help you, I just wrote a STM32 demo for my project, it includes a serial driver with circular queues and all. The link is in my signature.

Giovanni

Thanks for the answer…

Only one buffer for the 3 UARTS or for each one?? and what is the size of this buffer?

I know what is a shift register, but i don’t know how to use it, no even how it works with the USART… Can you explain me more or any page to read it? Or how to look for it in the Data Sheet please?

Thanks a lot!

There is a single buffer for each USART.

The transmit buffer (TDR) holds one data frame while the previous one is being transmitted by the shift register. The register becomes empty when the data is transferred into the shift register so you have a single buffer level in hardware.

The thing is explained on page 435/504 of the reference manual, there is a nice diagram with the registers clearly visible.

Giovanni

Thanks you very much =)