In stm32,inder to use uart rx with DMA, we could easily use:uart Idle interrupt+dma.but how in 52832 while how many byte of a frame to recevie is uncertainty?
in order to test,i designed a master mcu to transmit circulaly,each frame 11byte,period is 1s,baud 1M.
How to config 52832 uarte rx?
my try:set RXD.MAXCNT 255(a big buf). A time hanlder function(detect_a_frame) which call back each 1ms.in this funtion,read RXD.AMOUNT ,judge wheather recevie amount of buf had changed.if its amount unequal to 0,also stop change,regard a frame recevie finish.call function to change rx dma fifo manually.
unfortunately, it don't work.because i found that RXD.AMOUNT will not update until fill up rxbuf.like below:(the mosaic is the data had recevied, here maybe had run few second)
How could i make it work in case of 1M baud???I really holp for your help or offer a successful demo.Appreciate!!!
I would strongly suggest using the nrf_libuarte driver available in the SDK. It is designed to allow efficient use of the DMA buffers with the UART, and is double buffered to ensure that you don't drop any data when the buffers fill up.
You can read more about this driver here.
I would also recommend migrating to SDK v16.0.0 if you can, to get the latest version of the driver.
Thank you very much for your answer, but I don't think it can solve my doubts very well.
My problem is——only until dma buffer fill up, can i get event and read data from buffer?what the suitable size of RXD.MAXCNT should be setted?if setting 5 bytes,a frame with 6 bytes will not completely received?because when received 5 bytes,buffer fill up,switch to another buffered for received.but there remain 1byte,so the dma buffered will not fill up.Upper layer could not get a complete frame.
This problem is solved by the nrf_libuarte_async driver. It uses a timer to detect inactivity on the UART, and generates an interrupt even if the UART buffers are not full.
Then you can define a timeout period, and if no more data is received during this time you will still get an event from the driver with the currently received data.
Oh!I seen in SDK v16.0.0,thank you very much!
but could i easly to achieve in SDK v15.0.0?because many user codes had exist in my project.It maybe cost more time for me to migrate to SDK v16.0.0?