Jump to content
  • 0

how to send data repeatedly with uart in interrupt model


martin16

Question

Hello

I have looked at all the uart interrupt example, it all send data only once, so I have modified the xuartlite_intr_example.c so that it can send the data for 6 times using for loop.I hook up two uart, uart 0 is the usb so I can see the result from my PC, uart 1 is connect to the Pmod for a physical loop,only the uart 1 was connected to the interrupt controler. During the test the data only be send in the first time, the other 5 times there were nothing. But the TotalReceivedCount and TotalSentCount in void SendHandler and void RecvHandler all show that 32 bytes data were all been send and receive, it feels like the interrupt save all the data from last time and didnt reset it or the interrupt didnt restarted after the first time. I am wondering if there are some examples that can show me how to send the data repeatedly or somebody can have a look at my code main.c. I just simplely add a for loop for the UartLiteIntrExample to repeat 6 times and XUartLite_DisableInterrupt(&UartLite);XUartLite_ResetFifos(&UartLite); at the end to clear the fifo and disable interrupt. Any help would be appreciated.

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

I found this example that might help out--although it only references a receive interrupt, I at least find it easy to understand.  This example looks like a more comprehensive solution, though.  Another one, here, never said why it didn't work.

Looking over your code ...

Are you sure you wish to re-initialize your UARTlite, do self tests, and enable interrupts 6-times?  Sounds like many of those should be one time setup tasks, and you would want the interrupt system working throughout your processing only ever as long as you had data to send.

I would also recommend you connect your interrupt handlers before enabling interrupts.

Likewise, are you sure you want "while ((sendcount != final size)||(receive count != final size))"?  Sounds more like you want an "&&" in between those, rather than an ||.

I'm not sure how ending the UART test early would damage an OLED though ... :P

Dan

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...