2024-02-12 02:29 AM - last edited on 2024-02-14 01:41 AM by SofLit
Hi I followed this yt-guide for CAN-bus https://www.youtube.com/watch?v=JfWlIY0zAIc&t=918s
I'm however using a different type of nucleo board (L433RC-P in my case and F103C8tx in the video) and a different type of CAN-transceiver (MCP2561T-E/SN vs MCP2551 in the video). My board uses a different type of can periphery (can1 vs can). My solution to this difference was to just change all of the code where he writes can to can1. Yet checking with an oscilloscope, I don't seem to be sending any CAN signal.
relevant code:
Setup:
Solved! Go to Solution.
2024-02-14 01:21 AM
Hello,
Attached a project using NUCLEO-L433RC-P on which CAN1 is configured in loopback mode.
Details:
But be careful, here, HSI has been used as system clock because loopback mode is used. So the timings / jitter are similar on transmit and receive. But when you switch to Normal mode to communicate with another board you need to use HSE with a crystal as source of clock.
Hope it helps.
2024-02-12 02:51 AM
When I had similar problems, I needed a pull-up on the rx signal. You can enable the internal pullup.
2024-02-12 03:19 AM
Unfortunately it doesnt seem to be the problem in my case. My problem seems to be deeper as when i resume the code I lose the access to seeing the values of TxHeader and RxHeader.
2024-02-12 03:24 AM - edited 2024-02-12 03:25 AM
Hello,
No need for a transceiver for the loopback mode and configure the internal pull-up resistor on Rx pin.
Also I think you have another problem on filters: SlaveStartFilterBank = 0. Please change this value to 14.
2024-02-12 05:03 AM
"No need for a transceiver for the loopback mode and configure the internal pull-up resistor on Rx pin." Are you saying that i shouldn't have the rx-pin or should I have it? Also how do i not need a transceiver for loopback mode? Can i just connect the rx and tx pint to the osciallator?
2024-02-12 05:08 AM - edited 2024-02-12 05:11 AM
Hello,
In loopback mode Tx and Rx pins are automatically tied together internally by HW:
Please refer to the reference manual RM0394.
"Can i just connect the rx and tx pint to the osciallator?"
Which oscillator and why??
2024-02-12 05:50 AM
Can i just connect the rx and tx pint to the osciallator?
"osciallator": Do you mean oscilloscope? If yes. Indeed you can. Put the oscilloscope probe on Tx pin.
2024-02-12 05:53 AM
Ok yeah I understand now why a transceiver isn't needed. My point of using a oscillator was to check if a CAN-signal is being sent out (since when I click the resume button I lose the possibility of looking at the values in TxHeader and RxHeader. But I guess since I can't look into them it means a signal isn't sent out. How should i do the hardware part then? Just connect the rx-pin to the tx-pin?
2024-02-12 05:58 AM - edited 2024-02-12 05:58 AM
Look..
As I said, No need to connect Rx and Tx pins in loopback mode as are already connected together internally in this mode. Look at the figure I shared previously.
If you need to check the CAN frames output using an oscilloscope, the answer is: yes you can. Probe on Tx pin.
Hope it's clear.
2024-02-12 06:01 AM
You can look at the TX pin whilst in Loop-Back mode, the Rx pin will be internally disconnected as this is looped-back instead.
The baud rate via the prescaler and segment timings will be non-critical as they will implicitly match in loop-back.