Hi,
I am debugging the CAN function by S32K142, but the CAN can't work.
1>Board: S32K142EVB-Q100
2>SDK: S32K1xx RTM SDK V3.0.0
3>Example (from SDK): can_pal_s32k142
4>Debug status:
a. build the project and enter debugging successfully;
b. set breakpoint, as below:
c. when press the button sw2 or sw3, it can enter the ISR and goes to breakpoint 1/2;
d. when pass the breakpoint 3, I can't receive any data(probe the PTE5/CAN0_TX by oscilloscope);
Note: PTE5 is keeping '1' atfter reset.
Hope your help.
Thanks.
//--------------------------------------------------------------
void buttonISR(void)
{
/* Check if one of the buttons was pressed */
uint32_t buttonsPressed = PINS_DRV_GetPortIntFlag(BTN_PORT) &
((1 << BTN1_PIN) | (1 << BTN2_PIN));
bool sendFrame = false;
if(buttonsPressed != 0)
{
/* Set FlexCAN TX value according to the button pressed */
switch (buttonsPressed)
{
case (1 << BTN1_PIN):
ledRequested = LED0_CHANGE_REQUESTED;
sendFrame = true;
/* Clear interrupt flag */
PINS_DRV_ClearPinIntFlagCmd(BTN_PORT, BTN1_PIN); //----Set Breakpoint 1
break;
case (1 << BTN2_PIN):
ledRequested = LED1_CHANGE_REQUESTED;
sendFrame = true;
/* Clear interrupt flag */
PINS_DRV_ClearPinIntFlagCmd(BTN_PORT, BTN2_PIN); //----Set Breakpoint 2
break;
default:
PINS_DRV_ClearPortIntFlagCmd(BTN_PORT);
break;
}
if (sendFrame)
{
/* Set information about the data to be sent
* - Standard message ID
* - Bit rate switch enabled to use a different bitrate for the data segment
* - Flexible data rate enabled
* - Use zeros for FD padding
*/
can_buff_config_t buffCfg = {
.enableFD = true,
.enableBRS = true,
.fdPadding = 0U,
.idType = CAN_MSG_ID_STD,
.isRemote = false
};
/* Configure TX buffer with index TX_MAILBOX*/
CAN_ConfigTxBuff(&can_pal1_instance, TX_MAILBOX, &buffCfg);
/* Prepare message to be sent */
can_message_t message = {
.cs = 0U,
.id = TX_MSG_ID,
.data[0] = ledRequested,
.length = 1U
};
/* Send the information via CAN */
CAN_Send(&can_pal1_instance, TX_MAILBOX, &message); //----Set Breakpoint 3
}
}
}
//------------------------