Announcements

Equip yourself to optimize AURIX™ MCUs for Evs at the EV Webinar. Click here to register.

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

AURIX™ Forum Discussions

lior
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

Hi,

I know that there were some posts about this issue and read them and try all the instructions and ideas.

I try to send 20 bytes by uart with DMA.

I config like this:

/* This function initializes the ASCLIN UART module */
void init_ASCLIN_UART(void)
{
/* Initialize an instance of IfxAsclin_Asc_Config with default values */
IfxAsclin_Asc_Config ascConfig;
IfxAsclin_Asc_initModuleConfig(&ascConfig, &MODULE_ASCLIN0);

/* Set the desired baud rate */
ascConfig.baudrate.baudrate = UART_BAUDRATE;

/* ISR priorities and interrupt target */
ascConfig.interrupt.txPriority = INTPRIO_ASCLIN0_TX;
ascConfig.interrupt.rxPriority = INTPRIO_ASCLIN0_RX;//;
ascConfig.interrupt.typeOfService = IfxSrc_Tos_dma ;
ascConfig.fifo.txFifoInterruptLevel = IfxAsclin_TxFifoInterruptLevel_0;
/* FIFO configuration */
ascConfig.txBuffer = &g_ascTxBuffer;
ascConfig.txBufferSize = UART_TX_BUFFER_SIZE;
ascConfig.rxBuffer = &g_ascRxBuffer;
ascConfig.rxBufferSize = UART_RX_BUFFER_SIZE;

/* Pin configuration */
const IfxAsclin_Asc_Pins pins =
{
NULL_PTR, IfxPort_InputMode_pullUp, /* CTS pin not used */
&UART_PIN_RX, IfxPort_InputMode_pullUp, /* RX pin */
NULL_PTR, IfxPort_OutputMode_pushPull, /* RTS pin not used */
&UART_PIN_TX, IfxPort_OutputMode_pushPull, /* TX pin */
IfxPort_PadDriver_cmosAutomotiveSpeed1
};
ascConfig.pins = &pins;

IfxAsclin_Asc_initModule(&g_ascHandle, &ascConfig); /* Initialize module with above parameters */

}

after this configuration i check that in the SRC module i see the configuration of the interrupt.

 

DMA Init:

int InitDMA(uint8 *buf,unsigned int count)
{
dmaParams g_DMA;


/* Load default module configuration into configuration structure */
IfxDma_Dma_initModuleConfig(&g_DMA.dmaConfig, &MODULE_DMA);

/* Initialize module with configuration. */
IfxDma_Dma_initModule(&g_DMA.dmaHandle, &g_DMA.dmaConfig);

/* Get/initialize DMA channel configuration for all DMA channels otherwise use &g_Dma.dmaChannel as target */
IfxDma_Dma_initChannelConfig(&g_DMA.dmaChNCfg, &g_DMA.dmaHandle);

/* Set desired DMA channel: Channel 0 is used */
g_DMA.dmaChNCfg.channelId = IfxDma_ChannelId_0;

/* Setup the operation mode/settings for DMA channel */
g_DMA.dmaChNCfg.moveSize = IfxDma_ChannelMoveSize_8bit;
/* Set the number of DMA transfers */
g_DMA.dmaChNCfg.transferCount = (uint16)count;
/* Execute the DMA transaction with only one trigger */
g_DMA.dmaChNCfg.requestMode = IfxDma_ChannelRequestMode_completeTransactionPerRequest;

g_DMA.dmaChNCfg.destinationAddressCircularRange = IfxDma_ChannelIncrementCircular_none; /* Source address remains the same after transfer */
g_DMA.dmaChNCfg.destinationCircularBufferEnabled = TRUE; /* Enable the destination circular buffering */
g_DMA.dmaChNCfg.hardwareRequestEnabled = TRUE;

g_DMA.dmaChNCfg.operationMode = IfxDma_ChannelOperationMode_continuous;
g_DMA.dmaChNCfg.requestMode = IfxDma_ChannelRequestMode_completeTransactionPerRequest;


/* Set destination and source address data to DMA channel */

g_DMA.dmaChNCfg.sourceAddress = (uint32)&buf[0];

g_DMA.dmaChNCfg.destinationAddress = (uint32) &ASCLIN0_TXDATA.U;//0xF0000644;

 

IfxDma_Dma_initChannel(&g_DMA.dmaChannel, &g_DMA.dmaChNCfg);


return 1;

}

 

and the trigger for the begin sending:

/* This function sends  the string "Hello World! Hello World!" */
void sendASCLIN_UART_message(void)
{
        ASCLIN0_FLAGSSET.B.TFLS = 1;

}

after i call this function sendASCLIN_UART_message();

nothing happen , i check the TFLS  and i see that it is "1" but the DMA is not begin the transfer.

is someone can help me? 

lior

 

0 Likes
1 Reply
dw
Moderator
Moderator
Moderator
100 likes received 750 replies posted 10 likes given

dw_0-1672128806562.png

 

Suggest to start from Mem to Mem DMA transfer. If it's OK, then start a UART use case.

0 Likes