cancel
Showing results for 
Search instead for 
Did you mean: 

CAN FD network normal mode does not work with NUCLEO-C092RC boards

BNE
Associate II

Hello everyone,

 

i want to build a CAN FD network with three NUCLEO-C092RC boards. So far i can transmit frames, as i can see on an oscilloscope. But the moment i connect TWO boards, the interrupt is not triggered. My code should activate user LED2 if it receives a frame with one specific id:

Board 1 (0x101) triggers LED when receiving message 0x344 or 0x234

Board 2 (0x234) triggers LED when receiving message 0x344 or 0x101

Board 3 (0x344) triggers LED when receiving message 0x101 or 0x234

 

i use a nom. baudrate of around 500 kbit/s and data baudrate of 1 Mbit/s with a clock of 40 MHz (HSE).

The Boards are connected with two short (10cm) twisted jumper cables and the jumpers for the 120 Ohm resistor are also plugged in on both baords.

when i test it in external loopback mode, it works (with ident. change)

Could this just be a problem with my wires (reflexion , parasi. C ,etc.)?

 

thanks a lot for the help

1 ACCEPTED SOLUTION

Accepted Solutions
mƎALLEm
ST Employee

Another issue I've just detected in your configuration:

mALLEm_0-1777389471604.png

Nominal bitrate is at 2.5Mb/s!! You must not exceed 1Mb/s in the nominal phase with FDCAN.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

19 REPLIES 19
mƎALLEm
ST Employee

Hello @BNE and welcome to the ST community

Your situation and config is not quite clear to me.

So, you are using NUCLEO-C092RC boards and the loopback config is working well but it's not working in Normal mode right? 

 "So far i can transmit frames, as i can see on an oscilloscope"

(-> on which pin?

So, please clarify.

FDCAN NVIC enabled in your project?

Otherwise, attaching main.c is insufficient, we need to see the pin config, the clock config etc. So you should attach the complete project.

Please refer to the knowledge base article: STM32 FDCAN running at 8 Mb/s on NUCLEO boards

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
BNE
Associate II

Hello,

 

i connected the oscilloscope with two wires plugged into the green connector by the transceiver. so i measured the differential CAN-Signal. The transceiver uses PD1 and PD0 as TX and RX from the µC for FDCAN.

i think i messed something up with boths bit times, because i use BRS. Thank you for your help and for the link.

I calculated the settings for the nominal rate and the data rate with Bit Timing Calculator for CAN FD from kvaser.com.

The interrupt should be enabled. It is in the stm32c0xx_hal_msp.c file if i am not wrong

i will attach my three projects as a .zip file

 

Thanks for the support so far :)

Hello,

So do you confirm it sill not working even after your last check?

If not working, and by saying "the interrupt is not triggered", do you mean the RX interrupt is not triggered?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Karl Yamashita
Principal

So far i can transmit frames, as i can see on an oscilloscope. But the moment i connect TWO boards, the interrupt is not triggered.

This is a little confusing. So when you were transmitting before connecting TWO boards, did you only have one board transmitting without it connected to another working Nucleo? You can't successfully transmit with just one Nucleo and after so many tries, would enter a BUS off state. It won't transmit any data. It won't go out of BUS off state until it starts receiving valid data. In this case, you should be getting CAN Error interrupts callback.

 

Also, what interrupt are you referring to? Rx or Tx interrupt?

 

You sure you didn't cross the CAN_P with CAN_N? Did you connect the grounds on the CN14 to each Nucleo boards? 

 

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.
CAN Jammer an open source CAN bus hacking tool
CANableV3 Open Source

ghibli
Associate II

Hi @BNE, here's a bunch of hints to help you debug your project:

1) Do you have the chance to read the messages sent from your NUCLEO board with an external tool (such as a Vector or a Peak PCAN)? You said that you checked with a scope and in loopback mode, but a double check is maybe a good idea. You can directly connect CAN H and CAN L to the green header on the NUCLEO board.

2) Is the bit timing configuration the same on both the boards? Could you please share it just to check it is correct?

3) Can you try to setup a simple CAN communication rather than using an FDCAN (which is a bit more complicated to configure)?

4) Double check the resistance of the wiring: with both boards connected and termination active it should be around 60 Ohm.

5) Can you give a try deactivating all of the Rx filters just to check the communication is working properly? Then, if the communication is ok, you can reactivate them.

Hope this can help you.

Yes, i can confirm this. I also tested it with classical CAN. When debugging the code it never reaches 

void HAL_FDCAN_RxFifo1Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo1ITs)

in main.c

The first think i tested was one board and an oscilloscope. it showed a frame, which looked good. I tried it again after pressing reset, because i thought, it should reset the whole device back to error active. when i test one board in external loop back mode, the function:

void HAL_FDCAN_RxFifo1Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo1ITs)

is called, so (as far as i have understood it) an RX interrupt was triggered. But if i have two baords connected, it does not work.

CAN_P and CAN_N should be correct. i plugged in the wires into the same holes on both boards, so wire 1 into hole on the left and wire 2 in the hole in the middle.

I did not connect GND from board one to board two, because since the are both connected via USB, i thought they should have the same GND. I will test it, this could be the problem. at least it would explain why every bitrate i am testing does not work.

Thank you for the support, i will test with common GND

BNE
Associate II

i don't have access to PCAN oder a vector product. i have to check it with an oscilloscope.

I copied the whole bit timing setup into all main.c files, but i will double check.

So far just a classical CAN is also not working. I think the issue is not my CAN-FD setup but something else, which could be GND, as @Karl Yamashita said.

The wiring should be ok, but i will double check.

My filters are currently from 0 to 0x7FF with FDCAN_FILTER_RANGE, but i will also double check in every project.

Thanks for your support.

Ozone
Principal III

Your description is a bit too superficial to identify what is the problem.

> i want to build a CAN FD network with three NUCLEO-C092RC boards. ...
> The Boards are connected with two short (10cm) twisted jumper cables and the jumpers for the 120 Ohm resistor are also plugged in on both baords.

Does this Nucleo-C092 boards contain CAN transceiver ?
If not (and I suppose they have not), you can only connect two boards directly, on GPIO voltage level.
And you cannot use termination resistirs in this case.
To connect two nodes, you would need to cross Tx and Rx, like with UART.

> when i test it in external loopback mode, it works (with ident. change)

I would recommend to check the TEC and REC fields in the CAN error status register.
If the transmissions/receptions fail, this counters go up, and communication stops temporarily at some point.
Consult the CAN specification if necessary.