using SDMA for UART Transfer in IMX6Solox

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

using SDMA for UART Transfer in IMX6Solox

2,503 Views
niranjanbc
Contributor IV

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

Labels (3)
0 Kudos
Reply
4 Replies

1,690 Views
niranjanbc
Contributor IV

that doesn't give any information of sharing sdma between cores, also in IMX6SoloX case it is A9 linux and M4 FreeRtos

i need the details related to where in Linux have to make code changes to support M4 using SDMA.

0 Kudos
Reply

1,690 Views
igorpadykov
NXP Employee
NXP Employee

these examples for M4 using SDMA.

0 Kudos
Reply

1,690 Views
niranjanbc
Contributor IV

i tried the example mentioned in the above,  my first post, it is not working.

so i suspect , do i need to make any changes on A9 linux side.

even i tried adding below line in u-boot (mx6sxsabresd.c)that sets RDC for SDMA

static rdc_peri_cfg_t const shared_resources[] = {
(RDC_PER_SDMA | RDC_DOMAIN(0) | RDC_DOMAIN(1)),
};

can you look into my above code and comments i have in there. 

0 Kudos
Reply

1,690 Views
igorpadykov
NXP Employee
NXP Employee

Hi Niranjan

please check similar check example in MX6UL FreeRTOS SDK2.2 ../devices/MCIMXG3/drivers/fsl_uart_sdma.c

Board Support Packages (7)
SDK2.2_iMX6UL_WIN(REV SDK2.2)
http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/i.mx-processors/i.mx-6-pr...

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

0 Kudos
Reply