setting FlexCAN baud rate

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

setting FlexCAN baud rate

1,040 Views
KelvinSmith
Contributor III

I am trying to connect the s32k1SIC board to a radar sensor that requires a 500000 baud rate. I searched the internet and found a calculator and came up with the following values, except they did not give a value for ERJW, so I've tried a few guesses.

FlexCAN[i]->CBT |= CAN_CBT_BTF_MASK | /* Enable extended bit timing configurations for CAN-FD
for setting
up separetely nominal and data phase */
CAN_CBT_EPRESDIV(9) | /* Prescaler divisor factor of 1 */
CAN_CBT_EPROPSEG(4) | /* Propagation segment of 47 time quantas */
CAN_CBT_EPSEG1(7) | /* Phase buffer segment 1 of 19 time quantas */
CAN_CBT_EPSEG2(1) | /* Phase buffer segment 2 of 13 time quantas */
CAN_CBT_ERJW(2); /* Resynchronization jump width same as PSEG2 */

I'm testing in the uavcan demo. I am not getting any data from the radar, but I can see that it is sending it. I have it connected to the port labeled CAN0B, although I've tried them all.

0 Kudos
6 Replies

1,005 Views
KelvinSmith
Contributor III

I did compile the CAN 2.0 sample and unfortunately we still are not getting data through. The radar sensor we are connecting to does not use the increased speed during the data section, so the Can 2.0 version should be the right one. I'm running out of things to try to get it to work. 

0 Kudos

995 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@KelvinSmith

      If you have a CAN tool chain, such as PCAN or CANoe, you can test the working status of the CAN module of the MCU. If there is no problem with the working status of the MCU, then you can focus on the sensor ( You can try to add a terminal resistor on the CAN bus).

0 Kudos

1,038 Views
KelvinSmith
Contributor III
I should add that I commented out the code that set up the FDCBT data rate and it should not be enabled.
0 Kudos

1,014 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@KelvinSmith

If you are developing a project with binary code, you can refer to the two demos I sent you, one with CAN-FD enabled and one with CAN 2.0 enabled.
(These two projects were originally in the directory of S32 DS V2.2. If S32 DS V2.2 is not installed, it may not be able to compile directly, but you can refer to it)

0 Kudos

923 Views
KelvinSmith
Contributor III

We have made many tests with the S32K1SIC boards that we have, using LibuavCan and the FlexCan and CanFd samples that Senlent posted and still have not been able to get any CAN communication in to or out of the S32K1SIC boards.

I made a CAN cable with terminating resisters at both ends, because the terminating cable that was supposed to be included didn't seem to have been. This unfortunately didn't help.

When communicating between the two S32K1SIC boards, whether sending or receiving, we always see errors in the ECR and ESR1 fields, and no data is ever transmitted or received. This happens in the LibuavCAN demo as well as the FlexCAN, and forcibly the baud rate is matching in these cases.

We also connected to a Raspberry Pi using a USB2CAN converter by Innomaker. With this setup, we saw no errors in ECR and ESR1 but no data was transferred and after the transfer the IFLAG1 bit was never set indicating a transfer was made.

There is a wakeup line going to the transceiver, we have wondered if something is missing to assert that signal. There is also an edge lock device. Could that be disabling the CAN bus? Any suggestions would be appreciated. We have our code working on Raspberry Pi but would like to move to the S32K1SIC, but until we can get some CAN communication, this can't happen.

0 Kudos

910 Views
Senlent
NXP TechSupport
NXP TechSupport

I took a look at UCANS32K1SIC and found that its transceiver is TJA1463. If I understand correctly, you also need to configure TJA1463 to Normal mode.
I'm sorry that I don't have UCANS32K1SIC, so I can't help you test it. If you still have questions, I suggest you create a new topic, maybe there are experts in this field to help you answer