how to use UART for sending or receiving more number of data

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to use UART for sending or receiving more number of data

Jump to solution
2,286 Views
lijofrancis
Contributor III

dear sir,

I want to know how to use uart fifo or how to use dma .is it dma is same as fifo.

i want to send or receive uart data packets which may vary .i am using K60 board please tell me

how to use fifo and dma tell me which is better please give any example

1 Solution
1,471 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Lijo,

First of all, I'd like to states that the FIFO function and DMA implementation can be both applied at the same time.

However according to your requirement of sending or receiving vary number of data, I'd like to suggest that you should not choose the DMA function,

as the DMA need to set valid number of data to send or receive before the DMA operates.

According to your general requirements, I'd like to recommend that you can use FIFO function with interrupt to make it available.

I'll appreciate that you can share more detail about your project, then I can give you more precisely support.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
10 Replies
1,472 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Lijo,

First of all, I'd like to states that the FIFO function and DMA implementation can be both applied at the same time.

However according to your requirement of sending or receiving vary number of data, I'd like to suggest that you should not choose the DMA function,

as the DMA need to set valid number of data to send or receive before the DMA operates.

According to your general requirements, I'd like to recommend that you can use FIFO function with interrupt to make it available.

I'll appreciate that you can share more detail about your project, then I can give you more precisely support.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,471 Views
lijofrancis
Contributor III

dear sir ,

in my project we have cpu card and io card.when cpu card poll with 4 number of packets io card acknowledge with some number of bytes.then i request for input data from  io card then it  reply with data.

i am implementing io card.

i get receive poll packet number 4 and data request packet may be 6 .that can may vary with our new card

i transmit acknowledgement to poll packet 6 and reply to data packet we didnt decided the number.

so every defined packet comes i have to get interrupt.

then data takes processed and reply to cpu with specified number of data

so,fifo is better for my project please give some examples

maximum number of bytes can i use for fifo ?

where is FIFO/buffer ?

0 Kudos
1,471 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Lijo,

For instance,UART0 and UART1 of the MK60DN256VLL10 contains 8-entry transmit and 8-entry receive FIFOs, however other UARTs contain a 1-entry transmit and receive FIFOs.

It needs you to check the reference manual of the specific MCU.

About the usage of the FIFO, please refer to Re: How to use FIFO in uart comunication to view the details.

Wish it helps.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,471 Views
lijofrancis
Contributor III

dear sir,

if we can vary receiving packet length by using dma thats more prefer i think because fifo is limited for 8 fifo packets.

please respond .if i can use dma using uart please give me an example.i dont know the steps to implement dma please sir its very urgent.Thank you

0 Kudos
1,471 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Lijo,

Now I was a little confused and can you please state your demand in details again?

I've attached a DMA demo of K60 and you can refer to it.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,471 Views
lijofrancis
Contributor III

dear sir,

thank you .

ok my project is to read data packets from analog input card

we have cpu card and analog input card

i am working the development of analog input card.when i get poll packet from cpu card i have to send some packets as acknowledgment.After that cpu request for data packets then my analog input card reply with data bytes.

its the operation.For that if i am waiting for poll request ( 4 packets),i will set interrupt for 4 packet.when it comes i store it into buffer.Then if i am waiting for data packet request(12 packets),i will set interrupt for 12 packets.when it comes store into buffer.

this is my project please help for which method i have to use

0 Kudos
1,471 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Lijo,

Ok, I got it.

I still think the usage of FIFO with the interrupt is available to your project.

And what's current issue that you encounter?
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,471 Views
lijofrancis
Contributor III

hai sir,

but the problem is that with fifo ,8 bytes limited but we want more than 8 .

and can we change the receive packet length dynamically.i think in fifo i have to disable receive flag to change receive watermark.i dont know dma is it possible or not

0 Kudos
1,471 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Lijo,

It's not necessary to need the FIFO buffer to store all packet data. Once the FIFO become full, then will trigger the interrupt happen to read the received data and after that, the FIFO is going to become available for new coming data again.

However you want to choose the DMA, you should need to know the specific number that you will receive, or it will fail to meet your requirement.

Wish it helps.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,471 Views
lijofrancis
Contributor III

hello sir,

i did it using fifo method using uart0,i set maximum receive buffer depth 128 bytes.

receive watermark 4.if gets more data  ,the  overflow comes then  i read it..after reading i clear overflow flag.it works some time there is missing somwhere but data comes.but i have more doubts relating which method  i have to use for my project


   if i require interrupt,that gets only when more than 8 data comes ,is DMA method is prefer for me?

  In fifo also i can vary the length(UARTx_RWFIFO) of the data by only disable receive register RE(C2)

"This register may be read at any time but must be written only when C2[RE] is not asserted"

please tell me can i use DMA for my purpose?

please reply soon i am waiting for ur reply thank you

0 Kudos