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

cross mob
psoc_student
Level 3
Level 3
50 sign-ins 25 sign-ins 10 replies posted

Hello, I have an inquiry regarding Uart - DMA Interrupt.

I understand that DMA-Rx interrupts depending on the setting value.

For example, if you set the "Number of data elements to send" value to 10, an interrupt occurs when 10 is received.

Then, if you set it to 10 and divide it into 6 or 4 instead of 10, is there a function that can cause interruption for each case?

For ST, Interrupt of Uart may occur when the signal from Rx is in Idle state (=Transmission Interrupt).

If you wait for the DMA buffer to fill, and then generate and process interrupts, a large amount of incoming data is missing.

Is there a way to solve this problem?

Please give me a lot of advice.

0 Likes
1 Solution
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi @psoc_student 

 

PSoC supports multiple interrupt modes in DMA - 

Hari_0-1655874468783.png

In case you have the possible data transfer numbers, you can configure the number of data elements to transfer in code by using the Cy_DMA_Descriptor_SetXloopDataCount  API. The interrupt would be set to Trigger on every X loop completion and the data size in the X loop can be altered using the API mentioned above. 


Best regards, 
Hari

View solution in original post

0 Likes
7 Replies
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi @psoc_student 

 

PSoC supports multiple interrupt modes in DMA - 

Hari_0-1655874468783.png

In case you have the possible data transfer numbers, you can configure the number of data elements to transfer in code by using the Cy_DMA_Descriptor_SetXloopDataCount  API. The interrupt would be set to Trigger on every X loop completion and the data size in the X loop can be altered using the API mentioned above. 


Best regards, 
Hari

0 Likes

Hello @Hari

Is there a way to return the address stored in the receiving buffer of DNA-Rx to its initial state?

Looking for APIs that can stack from buffer [10] to 5 and then back to 0.

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi @psoc_student 

 

One way to do that would be to chain this to a second descriptor that stacks the buffer from 0 to 10. That way, after descriptor 0 completes, it will chain to descriptor 1 and fill from the required buffer address. 


Best regards, 
Hari

0 Likes

Hello @Hari 

 

Let's assume that 73 data are received consistently.

If, I received only 40 and got disconnected while receiving it.

If you get 73 data back when you reconnect, the existing 40 data and the new 73 data are combined to make it weird. To prevent this, we are looking for ways to initialize information about the receive buffer when the connection is disconnected.

Is there an API for this?

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi @psoc_student 

 

Case 1 - Descriptor 0 starts from 0 

In this case, a second Descriptor is not required. Descriptor 0 can be chained to itself so that once Desc0 completes, it will start again from Desc0 and fill the buffer. 

 

Case 2 - Descriptor 0 starts from Buffer address 5

In this case, you will need a second descriptor to chain so that it will start from Buffer address 0. In case you need to restart from buffer 0, you need to change the source address of Desc0 so that it restarts from Buffer 0. In this case, the descriptors will be chained to each other. Desc0 to 1 and Desc1 to 0. 

 

Best regards, 
Hari

0 Likes

안녕하세요  @Hari 

When using Desc 0 and Desc 1, shouldn't "Interrupt" occur in Desc 0 to move on to Desc 1? I would appreciate it if you could let me know if there is an API that can be forcibly changed in the middle.

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi @psoc_student 

 

You can automate it based on the number of elements to transfer. DMA chaining will ensure that the descriptor switch will happen automatically. 

 

The interrupt can be enabled to trigger on descriptor completion (as shown in my first response). This will help in changing the number of elements to transfer once the descriptor completes. 


Best regards, 
Hari

0 Likes