UART Sleep on TX completion

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 Hello,

   

I have a question on how to put the UART to sleep. My set up is an UART with the interrupt pin connected to the 'drq' of a DMA.

   

At the moment I have configured the UART to indicate the DMA to transmit data from the memory (RAM) to the UART's buffer once the UART has its buffer empty.

   

Now I want to put the UART to sleep, and what I have thought is using the DMA "nrq" interrupt and read the TX status register of the UART:

   

if(DMA_UART_flag == 1){

   

           DMA_UART_flag = 0;

   

            reg = UART_ReadTxStatus();

   

            while((reg & UART_TX_STS_COMPLETE) != UART_TX_STS_COMPLETE){

   

                reg = UART_ReadTxStatus();

   

            }

   

            UART_Sleep();

   

}

   

However, it remains in the loop... Any idea?

   

Thank you in advance!

0 Likes
5 Replies
Anonymous
Not applicable

Try to post your complete code...it'll give a clear indication of what exactly is happening!!!

   

Also, do you want your UART to remain in sleep mode........how & when do you want it to come out of sleep mode?

   

Regards,

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Furthermore you may post the complete project here, so we all can have a look at. To do so, use the "Create Workspace Bumdle" function of Creator 2.2 and upload the resulting .zip-file,

   

 

   

Bob

0 Likes
Anonymous
Not applicable
        Hi chizr,   
Something need to ask.   
1) How much Tx buffer size? Is it enough for DMA transfer?   
2) Use UART_TX_STS_FIFO_EMPTY instead of UART_TX_STS_COMPLETE?   
3) How about programming without DMA, before use DMA?   
4) Would you mind of Build Setting / Compiler / Optimization,   
highest size reduce setting is effective to communication program,   
I don't know the reson but from my experience anyway.   
0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        I have made some changes, but it still does not work...   
0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        Hi, Your design is temporarily working.   
Wave1 is DMA and 2 is UART.   
It seems UART work once, sleep, wakeup, work again and sleep forever.   
Maybe UART can't wakeup again.   
   
Cheers ! Please think and do again yourself.   
Can't help you, because my mom say.   
Do not take away the fun of debugging, It's a sin.   
0 Likes