SPC560P-DISP CAN TX
I've got the CAN Test app loaded and working as it should. I'm trying to get it to transmit out instead of loopback. I've already uncheck the option for loopback and simplified the code to only transmit. However, I don't see any activity on the CAN pins of the board. I've tried moving the jumpers from CAN0 to CAN1 and I've tried looking at the signal before the transceiver but still nothing. My code is attached below. Any help would be greatly appreciated!
#include "components.h"
#include "can_lld_cfg.h"
/**
* FLEXCAN Error callback. This is kept for good practice but is not essential
* for transmitting.
*/
void cfg0_errorcb(CANDriver *canp, uint32_t esr,uint8_t rx_err_counter, uint8_t tx_err_counter){
(void)canp;
(void)esr;
(void)rx_err_counter;
(void)tx_err_counter;
}
/**
* FIFO notification callback. This is no longer used since we are only
* transmitting messages.
*/
void cfg0_Fifo_RX(CANDriver *canp, CANRxFrame crfp) {
(void)canp;
(void)crfp;
}
/*
* Application entry point.
*/
int main(void) {
/* Define the CAN transmission frame */
CANTxFrame txmsg;
/* Initialize all the necessary components */
componentsInit();
/* Enable Interrupts for the CAN driver to function */
irqIsrEnable();
/*
* Activate the CAN driver with the specified configuration.
*/
can_lld_start(&CAND1, &can_config_cfg0);
/*
* Configure the CAN message that will be sent repeatedly.
*/
txmsg.IDE = CAN_IDE_STD; // Use an extended 29-bit identifier
txmsg.EID = 0x2F; // The extended identifier value
txmsg.RTR = CAN_RTR_DATA; // This is a data frame, not a remote frame
txmsg.LENGTH = 8U; // The message will have 8 bytes of data
txmsg.data32[0] = 0x11223344U; // First 4 bytes of data
txmsg.data32[1] = 0x55667788U; // Second 4 bytes of data
/* Application main loop.*/
for ( ; ; ) {
/* Transmit the CAN message using mailbox 1.
* The while loop ensures that we wait if the mailbox is busy.
*/
while (can_lld_transmit(&CAND1, 1, &txmsg) == CAN_MSG_WAIT) {
}
/* Wait for 250 milliseconds before sending the next message */
osalThreadDelayMilliseconds(250UL);
}
}