AnsweredAssumed Answered

using SDMA for UART Transfer in IMX6Solox

Question asked by niranjanbc on Aug 3, 2017
Latest reply on Aug 4, 2017 by niranjanbc

Hi I am trying to use SDMA for Uart Transfer on M4 side.

can any one please share the details on what are the changes required on A9 linux and M4 FreeRtos to support the Uart transfer using SDMA.

 

I am using FreeRTos SDK "FreeRTOS_BSP_1.0.1_iMX6SX" . since it doesn't have any example code for sdma.

 

I tried to take the sample code from "SDK_2.2_MCIM6UL", below was the code i took from SDK.

 

#define UART_RX_DMA_REQUEST (33)
#define UART_TX_DMA_REQUEST (34)

 

 

/*******************************************************************************
* Variables
******************************************************************************/
AT_NONCACHEABLE_SECTION_ALIGN(uart_sdma_handle_t g_uartSdmaHandle, 4) = {0};
AT_NONCACHEABLE_SECTION_ALIGN(sdma_handle_t g_uartTxSdmaHandle, 4) = {0};
AT_NONCACHEABLE_SECTION_ALIGN(sdma_handle_t g_uartRxSdmaHandle, 4) = {0};

AT_NONCACHEABLE_SECTION_ALIGN(sdma_context_data_t context_Tx, 4) = {0};
AT_NONCACHEABLE_SECTION_ALIGN(sdma_context_data_t context_Rx, 4) = {0};

AT_NONCACHEABLE_SECTION_ALIGN(uart_transfer_t sendXfer, 4) = {0};
AT_NONCACHEABLE_SECTION_ALIGN(uart_transfer_t receiveXfer, 4) = {0};

AT_NONCACHEABLE_SECTION_ALIGN(uint8_t g_tipString[], 4) =
"Uart sdma transfer example\r\nBoard receives 8 characters then sends them out\r\nNow please input:\r\n";

AT_NONCACHEABLE_SECTION_ALIGN(uint8_t g_txBuffer[ECHO_BUFFER_LENGTH], 4) = {0};
AT_NONCACHEABLE_SECTION_ALIGN(uint8_t g_rxBuffer[ECHO_BUFFER_LENGTH], 4) = {0};

 

 

 

UART_GetDefaultConfig(&config);
config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;
config.rxFifoWatermark = 1;
config.enableTx = true;
config.enableRx = true;

UART_Init(UART5, &config, DEMO_UART_CLK_FREQ);

 

 

/* Init the SDMA module */

 

RDC_SetPdapAccess(RDC, rdcPdapSdma, 3 << (BOARD_DOMAIN_ID * 2), false, false);


SDMA_GetDefaultConfig(&sdmaConfig); --> I commented out this part because thinking this would be done in A9 
SDMA_Init(EXAMPLE_UART_DMA_BASEADDR, &sdmaConfig);I commented out this part because thinking this would be done in A9 


SDMA_CreateHandle(&g_uartTxSdmaHandle, SDMAARM, UART_TX_DMA_CHANNEL, &context_Tx);


SDMA_CreateHandle(&g_uartRxSdmaHandle, SDMAARM, UART_RX_DMA_CHANNEL, &context_Rx);


SDMA_SetChannelPriority(SDMAARM, 1, 3U);
SDMA_SetChannelPriority(SDMAARM, 2, 4U);

 

/* Create UART DMA handle. */
UART_TransferCreateHandleSDMA(UART5, &g_uartSdmaHandle, UART_UserCallback, NULL, &g_uartTxSdmaHandle,
&g_uartRxSdmaHandle, UART_TX_DMA_REQUEST, UART_RX_DMA_REQUEST);

 

 

Can you please let me know what changes need to done in Linux A9 side and What i am missing in M4 side.

How do i choose available Channel for M4, if A9 is using some already.

 

 

Thanks

Niranjan

Outcomes