Transmitting large packet of data via UART

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

cross mob
SySa_4665481
Employee
Employee
5 sign-ins Welcome! 10 replies posted

Hi,

It seems that the max no. of bytes that could be transmitted at any one time using the API cyhal_uart_write() is 128.

For my application (e.g. bootloader) which requires transmission of 512 bytes at one go, what would be the recommendation?

Thank you in advance for any help/pointers.

Best Regards,

Syafii

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hi SySa_4665481​,

You can do the following:

Set the X and Y loops according to this formula given in PSoC 6 Architecture TRM

pastedImage_0.png

Let's say you want to transfer 500 bytes from Source to Destination. You can set the DMA configurator as follows:

pastedImage_1.png

I'm sharing the source files for the project I created that transfers 500 bytes of data from UART every 2 seconds. You can choose to trigger the DMA transaction whenever the application wants. You can set the source buffer,  destination buffers, no of X loops, Y loops, source , Destination increment etc. in run time also using the descriptor related functions

PSoC 6 Peripheral Driver Library: Descriptor Functions

Review the design.modus file for the configuration settings for DMA and UART.

If the above example doesn't help, please feel free to post your sample code here, we will try to debug it here.

Regards,

Bragadeesh

Regards,
Bragadeesh

View solution in original post

3 Replies
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi SySa_4665481​,

You can use the API cyhal_uart_write_async() to transfer more than 128 bytes (TX FIFO size). This is a non-blocking function that initiates a UART transfer. The internal UART ISR takes care of further data transfer. The end of the event can be checked using callback event CYHAL_UART_IRQ_TX_DONE. f

See Snippet 2 : Hardware Abstraction Layer (HAL)

If you want to offload the CPU, you can make use of DMA to do the transfer.

See GitHub - cypresssemiconductorco/mtb-example-psoc6-uart-transmit-receive-dma: This example demonstrat...  

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes

Hi BragadeeshV_41,

Thank you for the pointers.

I would like to use DMA for the transfer.

From the example, it seems like the transmit will happen upon trigger from the receive channel.

I would like to have a much simpler use-case whereby I would like to transmit after I have filled up the buffer.

I have been trying but no success yet.

Will you be able to provide me with an example for this use-case? Or some pointers on the configuration and APIs to use.

Best Regards,

Syafii

0 Likes
lock attach
Attachments are accessible only for community members.

Hi SySa_4665481​,

You can do the following:

Set the X and Y loops according to this formula given in PSoC 6 Architecture TRM

pastedImage_0.png

Let's say you want to transfer 500 bytes from Source to Destination. You can set the DMA configurator as follows:

pastedImage_1.png

I'm sharing the source files for the project I created that transfers 500 bytes of data from UART every 2 seconds. You can choose to trigger the DMA transaction whenever the application wants. You can set the source buffer,  destination buffers, no of X loops, Y loops, source , Destination increment etc. in run time also using the descriptor related functions

PSoC 6 Peripheral Driver Library: Descriptor Functions

Review the design.modus file for the configuration settings for DMA and UART.

If the above example doesn't help, please feel free to post your sample code here, we will try to debug it here.

Regards,

Bragadeesh

Regards,
Bragadeesh