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

AURIX™ Forum Discussions

xiaoxuan
Level 1
5 sign-ins First reply posted First question asked
Level 1

Hello,

I am trying to use DMA to communicate with ASCLIN_LIN. I have met some difficulties and need help.

Failed to receive or send LIN data, and failed to enter the interrupt function

Can you help me see what's wrong with the program

DMA_Init

{
/* Initialize one instance of IfxAsclin_Lin_Config with default values */
IfxAsclin_Lin_Config linMasterConfig1;
IfxAsclin_Lin_initModuleConfig(&linMasterConfig1, &MODULE_ASCLIN1);
linMasterConfig1.linMode = IfxAsclin_LinMode_master; /* Set the LIN mode of operation */
linMasterConfig1.brg.baudrate = EC_LINB_BRT; /* Set the desired baud rate */
linMasterConfig1.data.checksum = EC_LINB_CheckSumType; /* Checksum Type*/
linMasterConfig1.isInterruptMode = TRUE;
linMasterConfig1.interrupt.rxPriority = IFX_INTPRIO_ASCLIN1_RX;
linMasterConfig1.interrupt.txPriority = IFX_INTPRIO_ASCLIN1_TX;
linMasterConfig1.interrupt.typeOfService = IfxSrc_Tos_cpu0 ;
const IfxAsclin_Lin_Pins pins =
{
&LIN_B_RX_PIN, IfxPort_InputMode_pullUp, /* RX port pin */
&LIN_B_TX_PIN, IfxPort_OutputMode_pushPull, /* TX port pin */
IfxPort_PadDriver_cmosAutomotiveSpeed4
};
linMasterConfig1.pins = &pins; /* Port pins configuration */
/* Initialize module */
IfxCpu_Irq_installInterruptHandler(&DMA_ISR_LinB_rx, IFX_INTPRIO_ASCLIN1_RX);
IfxCpu_Irq_installInterruptHandler(&DMA_ISR_LinB_tx, IFX_INTPRIO_ASCLIN1_RX);
IfxAsclin_Lin_initModule(&g_linMaster1, &linMasterConfig1);
volatile Ifx_SRC_SRCR *src=IfxAsclin_getSrcPointerRx(linMasterConfig1.asclin);
IfxSrc_init(src, IfxSrc_Tos_dma, IFX_INTPRIO_ASCLIN1_RX);
IfxSrc_enable(src);
volatile Ifx_SRC_SRCR * src1 = IfxAsclin_getSrcPointerTx(linMasterConfig1.asclin);
IfxSrc_init(src1, IfxSrc_Tos_dma, IFX_INTPRIO_ASCLIN1_TX);
IfxAsclin_enableRxFifoFillLevelFlag(linMasterConfig1.asclin, TRUE);
IfxSrc_enable(src1);
}

 

LIN_Init

{
/* Initialize one instance of IfxAsclin_Lin_Config with default values */
IfxAsclin_Lin_Config linMasterConfig1;
IfxAsclin_Lin_initModuleConfig(&linMasterConfig1, &MODULE_ASCLIN1);
linMasterConfig1.linMode = IfxAsclin_LinMode_master; /* Set the LIN mode of operation */
linMasterConfig1.brg.baudrate = EC_LINB_BRT; /* Set the desired baud rate */
linMasterConfig1.data.checksum = EC_LINB_CheckSumType; /* Checksum Type*/
linMasterConfig1.isInterruptMode = TRUE;
linMasterConfig1.interrupt.rxPriority = IFX_INTPRIO_ASCLIN1_RX;
linMasterConfig1.interrupt.txPriority = IFX_INTPRIO_ASCLIN1_TX;
linMasterConfig1.interrupt.typeOfService = IfxSrc_Tos_cpu0 ;
const IfxAsclin_Lin_Pins pins =
{
&LIN_B_RX_PIN, IfxPort_InputMode_pullUp, /* RX port pin */
&LIN_B_TX_PIN, IfxPort_OutputMode_pushPull, /* TX port pin */
IfxPort_PadDriver_cmosAutomotiveSpeed4
};
linMasterConfig1.pins = &pins; /* Port pins configuration */
/* Initialize module */
IfxCpu_Irq_installInterruptHandler(&DMA_ISR_LinB_rx, IFX_INTPRIO_ASCLIN1_RX);
IfxCpu_Irq_installInterruptHandler(&DMA_ISR_LinB_tx, IFX_INTPRIO_ASCLIN1_RX);
IfxAsclin_Lin_initModule(&g_linMaster1, &linMasterConfig1);
volatile Ifx_SRC_SRCR *src=IfxAsclin_getSrcPointerRx(linMasterConfig1.asclin);
IfxSrc_init(src, IfxSrc_Tos_dma, IFX_INTPRIO_ASCLIN1_RX);
IfxSrc_enable(src);
volatile Ifx_SRC_SRCR * src1 = IfxAsclin_getSrcPointerTx(linMasterConfig1.asclin);
IfxSrc_init(src1, IfxSrc_Tos_dma, IFX_INTPRIO_ASCLIN1_TX);
IfxAsclin_enableRxFifoFillLevelFlag(linMasterConfig1.asclin, TRUE);
IfxSrc_enable(src1);
}

0 Likes
3 Replies
Prudhvi
Moderator
Moderator 25 solutions authored 10 likes received 100 sign-ins
Moderator

Hello,

Please refer to below code examples:

https://github.com/Infineon/AURIX_code_examples/tree/master/code_examples/ASCLIN_LIN_Master_1_KIT_TC...

https://github.com/Infineon/AURIX_code_examples/tree/master/code_examples/UART_DMA_Transfer_1_KIT_TC...

Please use the first one for ASCLIN_LIN Initialization followed by the second example for DMA. You may adapt the second example to use LIN instead of UART.

Regards,

Prudhvi.

0 Likes
xiaoxuan
Level 1
5 sign-ins First reply posted First question asked
Level 1

Thank you very much  

 

But the initialization of the first example, ASCLIN_LIN, has no setting for interrupts.  DMA initialization in the second example is using a hardware interrupt, please use hardware interrupt just below the  CFG.HardwareRequestEnabled = TRUE;  Is that enough?  How is a hardware interrupt triggered? 

0 Likes
Prudhvi
Moderator
Moderator 25 solutions authored 10 likes received 100 sign-ins
Moderator

Hello,

Setting the "CFG.HardwareRequestEnabled" alone to "TRUE" is not enough, please analyze the complete DMA Init function and wherever the UART  specific configurations are done, it shall be adapted accordingly with LIN.

Regards,

Prudhvi.

0 Likes