I've been following along with the Unit test for the CAN_FD Driver, and as far as I know, I'm using the API correctly, however, when I try to send any number of bytes, the payload is not attached to the the CAN Message
{ const int CAN_PKT_LEN = 4; int errCode, retval; uint8_t canPkt[CAN_PKT_LEN] = {0}; uint16_t temp = (uint16_t) ((rangeEst) * 1000.f); canPkt[0] = (uint8_t)(temp & 0x00FF); canPkt[1] = (uint8_t)((temp & 0xFF00) >> 8); temp = (uint16_t) (linearSNRest); canPkt[2] = (uint8_t)((temp & 0xFF00) >> 8); uint8_t acc = 0; for (int i = 0; i < CAN_PKT_LEN; ++i) { acc += canPkt[i]; } canPkt[3] = ((uint8_t)(acc)) ^ 0xFF;
CLI_write("Sending CAN Data %u, %u, %u with checksum %u \n", canPkt[0], canPkt[1], canPkt[2], canPkt[3]); retval = CANFD_transmitData(txMsgObjHandle, txMsgObjectParams.msgIdentifier, CANFD_MCANFrameType_FD, CAN_PKT_LEN, canPkt, &errCode); if (retval < 0){ CLI_write("Error: CANFD transmit data failed [Error code %d]\n", errCode); } //while (gTxDoneFlag == 0); //gTxDoneFlag = 0; }
I see data over the CLI, however, on my Oscope, I see the MSG_ID, 0101, and then 000000 - which is an Error Message. This repeats a handful of times, then eventually stops.
On the CLI, I see a -3502 code, which corresponds to a CANFD_EINUSE error. At no point do I ever get my 4 data packets that I'm trying to output, and are cloned to CLI.