cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN not working on Nucleo U545 boards?

robzeno
Associate II

I've tried both Zephyr RTOS and an STM32CubeIDE HAL project, and cannot get the FDCAN interface to work.

After performing requisite initialization steps, I add a packet to the TX FIFO. No error is returned, but no packet is transmitted. I can repeat this two more times, but on the fourth attempt, I will get an error because the TX FIFO is full.

I have attached a logic analyzer to the TX pin (PA12), and I do not see any output (the line remains in the same state). On Zephyr, I've instrumented the driver on Zephyr, and verified that no CAN interrupts are happening.  UART is working (I get debug output).

Since that wasn't working, I used the STM32CubeIDE to create a new project and "borrowed" some CAN transmit code from another ST sample, and I see the same behavior -- the code enqueues a CAN message to the TX FIFO, waits a second, and repeats. On the fourth attempt, we get an error that the TX FIFO is full. I'm happy to provide this code if it helps. I've tried multiple U545 boards as well as two different CAN transceivers (ATA6571, MCP2542) and the behavior is the same. (I've attached the STM32CubeIDE ioc file as well as the main.c file -- I can provide more if it helps).

Any recommendations for what to try?

1 ACCEPTED SOLUTION

Accepted Solutions
robzeno
Associate II

Hey, everybody -- thanks for the suggestions and help.

I was able to get the board working.  I switched to a different transceiver board (I'd been using a couple different click boards from Mikroe -- with an ATA6571 and a MCP2542) from Adafruit (with an NXP TJA1051) and it worked.  The Mikroe boards were a little more complicated as far as wiring goes, and I must have just not had something quite right (plus I've made a handful of software improvements as people made suggestions), but this simpler transceiver connection worked like a charm.

Really appreciate everyone's support here.  Cheers!

View solution in original post

8 REPLIES 8
SofLit
ST Employee

Hello,

My first thought is that there is a HW issue.

What about STBY pin status of the transceiver (MCP2542)? did you connect it to the ground?

Also regarding BS1 and BS2 values: you need to increase them as much as possible and decrease the nominal prescaler as much as possible with BS1 =  X% * (BS1+BS2) where X: is from 75 to 90. (ideal 87.5%).

Moreover, it's not recommended to use internal RC oscillators use the external crystal provided on the board instead (24MHz).

 

 

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.
SofLit
ST Employee

Also you are in Classical mode with 1.6Mb/s .. Are you sure this is the config you are using? In classical mode you should not exceed 1Mb/s!

SofLit_1-1710403773958.png

 

 

 

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.

I was really hoping this was going to be the problem, but nope.  I've tweaked my project file with much more appropriate clocks and CAN timings (we're trying to run at 250 kbps), but it didn't fix anything.

I'm attaching the updated project file and some changed source files (I had also enabled USART3 for some other testing I'll be doing).

The standby pin on the transceiver is connected to a GPIO (PC2) which I clear at startup.

robzeno
Associate II

I've tried enabling interrupts as well, but none happen.  I don't get called back for errors or TX complete or anything at all.  I simply cannot get the FDCAN interface on the STM32U545 to transmit a message.  It seems completely broken.

Hello,

Are you connecting a second node on the CAN bus (you didn't provide any information about that)?  Because you need at least two nodes attached to the CAN bus communicating at the same bitrate to make it working as expected for Acknowledgement mechanism.

Could you please provide a diagram of your HW of the two nodes with some details of the connections?

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.
robzeno
Associate II

Sorry, yes, I should have added that.  I have multiple nodes that can communicate with each other -- including an STM32F405 board (which includes the older classic CAN, not FD, controller).   The other two nodes are USB-CAN devices attached to my PC for debugging.  I run "can_moni" on one of those, and I send from the other one to make sure the CAN bus is working.  I can also send from the STM32F405.  I just can't send from the STM32U545.

I've attached a diagram -- hopefully it is helpful.

Also, I think I've said this, but I have a scope monitoring the CAN TX and CAN RX pins on the STM32U545, and I never see any changes on those lines; they just hover in the "high" (recessive?) state.  I would think I should see SOMETHING?

And I've tried a lot of things -- I did a bunch of searching, and there were many suggestions (checking termination -- have done, with multimeter), trying loopback mode (have done -- still don't see packets at the other nodes, although it does change the SW behavior), trying multiple ways to prevent transceiver "standby" mode (I've tried both high and low, though I think high is correct per the datasheet), even trying to switch TX/RX lines in case something on my board was mislabeled, etc.  I've even tried multiple different transceivers.  The longer I work on this, the more it "feels" like an interaction between the transceiver and the controller, but the only thing I have to look at there is the CAN TX and CAN RX lines, and I'm not seeing anything there.  I'm guessing I need to much better understand what really happens on CAN TX/CAN RX when someone transmits in order to debug this.

robzeno
Associate II

Hey, everybody -- thanks for the suggestions and help.

I was able to get the board working.  I switched to a different transceiver board (I'd been using a couple different click boards from Mikroe -- with an ATA6571 and a MCP2542) from Adafruit (with an NXP TJA1051) and it worked.  The Mikroe boards were a little more complicated as far as wiring goes, and I must have just not had something quite right (plus I've made a handful of software improvements as people made suggestions), but this simpler transceiver connection worked like a charm.

Really appreciate everyone's support here.  Cheers!