cancel
Showing results for 
Search instead for 
Did you mean: 

Using circle buffer in STM32F4 MCU to load data from wifi module

Ond?ej Dvo?�k
Associate II
Posted on January 27, 2016 at 09:02

Hi all,

I have software circullar buffer, parser, state machine for wifi module SPWF01. Everything is ok, but i must loaded data in IRQ every one byte. I will used DMA circle buffer and loaded long data burst but i think this is not possible, because module had not define rules for comunication frame length. Please tell me im wrong and communication frame lenght has define frame lenght (long as 2^n byte or some others rule). Thanks for reply. Ondra
8 REPLIES 8
Posted on January 29, 2016 at 08:54

Hi,

it's not clear for me what's ths point.

I understand you need details on external host (STM32F4), how to manage UART to wifi module. In this case, my suggestion is to submit your request to proper STe2eCommunity forum.

Regards

jerry

Ond?ej Dvo?�k
Associate II
Posted on January 29, 2016 at 13:53

Sorry for me English but i mean rules of data frame which send Wifi Module to MCU, not functionality UART module in STM32. If rule exist (rule as frame lenght 2^n ... ) i will use HW circle buffer in STM32F4. In this time i muss loaded data in IRQ routine every one byte and put to software circular buffer.

Best regards Ondra

Posted on January 29, 2016 at 14:03

There is no rule about length.

You can take a look at application note. Main indications from module come with a format ''\r\n+WIND:xx:...\r\n'', but there are others messages which does not respect this pattern.

Use interrupt on every byte is really not a good idea. Use a circular buffer is ok, but you must parse this buffer on particular interrupts: IDLE line, HALF buffer, FULL buffer, or other.

Again. please contact proper forum for this purpose.

j

Ond?ej Dvo?�k
Associate II
Posted on February 01, 2016 at 09:25

But i mean burst leng as two bytes is imposible to use (dropped last {lf} in some case when use 2 bytes burst). Format hasnt defined length rule. In some case when you used 4,8,16 bytes burst you dont get full command from module, because pop and push index of circle buffer are bad, especially push.  Again sorry for my english. I think this topic will be in Wi-Fi modules tree

Posted on February 01, 2016 at 09:41

Hi Ondra,

I think I don't really get your question. I'm sorry. I hope someone else on forum can help you (and me) explaining what's the point.

This is what I understand:

- you are using a circular buffer to manage UART RX line from module;

- you are not sure about when you should read that buffer, and parse received data;

- you tried checking every received byte, every 2 bytes, 4 bytes, 8 bytes, etc. Problem is that received data is not always a multiple of 2/4/8;

Can you confirm (or reject)?

j

Ond?ej Dvo?�k
Associate II
Posted on February 01, 2016 at 10:34

Hi gallucci, thanks for answer.

Yes, my point is problem of recevied data length. Because HW DMA circle buffer burst length 2,4,8... if understand RM. I have aaplication which working  and i use irq for load data to circle buffer. Im only try implemented HW dma circle buffer for RX WIFI module comunication.

Posted on February 01, 2016 at 10:45

Hi Ondra,

it's simpler than expected. This is why I suggested to switch to STM32F4 forum.

Do not use UART Rx IRQ to fill the buffer on each received byte. Use directly DMA, and wait for an event before processing the buffer.

If you are using an OS, it's much more simple: create a task, and stop it on a semaphore. Release the semaphore on IDLE line UART IRQ, or DMA Half/Full-buffer IRQ. This way, interrupts job it's simply a semaphore release.

On the other side, task is always waiting for an event. No events, no run. When event happens, it sscans the buffer, looking for ''\r\n+WIND:%d:%s\r\n'', and parsing %d (and, if needed, %s).

There is no need to know the length of received strings.

Hope it helps you

jerry

Ond?ej Dvo?�k
Associate II
Posted on February 01, 2016 at 10:57

Hi jerry,

Thanks for your time. It may help me. I get your point and also it simple when im expected. Again thanks you Ondra