Hi,
I have a tilt sensor with a CAN interface. It continously sends out data at 250 kbit/s which I can observe with an analyzer that I have connected to the bus as well. The plan is, the receive the CAN data with my K64. I have followed https://www.nxp.com/docs/en/application-note/AN1798.pdf as best as I could to calculate the timings:
- CLOCK_SYS_GetFlexcanFreq() tells me that my CAN system clock frequency is 14,400,000 (14.4MHz).
- The cable length is irrelevant (4m)
- And there's a 12MHz oscillator on my board
I've been trying to follow to example at KSDK_1.3.0/examples/twrk64f120m/driver_examples/flexcan/flexcan_network/main.c and with the above information, I came up with the following timing parameters:
flexcan_time_segment_t bit_rate_table_14_4Mhz[] = {
{ 1, 7, 3, 1, 1},
};
and I have considerable doubt, that these values are correct. I was unable to find all the information required in the datasheets for my sensor ENG_SS_G-NSDOG2-200_207 Inclinometer A4
I set my config up like:
flexcan1_data.max_num_mb = 16;
flexcan1_data.num_id_filters = kFlexCanRxFifoIDFilters_8;
flexcan1_data.is_rx_fifo_needed = false;
flexcan1_data.flexcanMode = kFlexCanNormalMode;
and set the global mask to 0x7ff:
result = FLEXCAN_DRV_SetRxMbGlobalMask(flexcanInstance, kFlexCanMsgIdStd, 0x7ff);
which I don't think is related as whenever I call:
RxStatus = FLEXCAN_DRV_GetReceiveStatus(flexcanInstance);
RxStatus is set to 7 (kStatus_FLEXCAN_RxBusy), even when the sensor is not sending anything (is powered off). Can anybody point me in the right direction as to what I might be missing?