This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to use uarte in 1M baud. RXD.AMOUNT will not update until fill up rxbuffer?

SDK:V15

chip:52832

development kit:window+keil

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!!!

Parents
  • Hi 

    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. 

    Best regards
    Torbjørn

  • 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.

Reply
  • 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.

Children
Related