Good afternoon, I am using the MCU LPC54628 from the test board. I am using the example lpcxpresso 54628_mcan_loopback. With the help of a breadboard I installed the MPC2551 transceiver, to take the signals from my MCU, TX and RX, and get CANL and CANH, but it doesn't work, does anyone know why? the program runs normally and doesn't give me failures.
Regards
For the test mode, you don't need a CAN transceiver.
Check the user manual (UM10912), section 35.14.1.7, and perhaps the CAN peripheral chapter (35) in general.
And check with the description of your SDK example if it goes for internal or external loop back mode.
@frank_m I know, but I want to see the CANH and CANL signals, because I need it to send it abroad.
As said, I don't know the SDK example, but I think you can modify it to use external loop-back (i.e. Tx and Rx physically linked externally).
Don't you have an experienced mentor near you, who can help you ?
You seem a bit overwhelmed at the moment, and fora like this take quite a lot of time, and don't guarantee answers. Or correct answers ...
No, it's just that this is the first time I've used it, I think it's externally configured.
Hi Nadia!
In this case the loopback example of the LPC546xx will work regardless of the RX and TX pins, that may explain the reason why you are able to see that it works without any signals being generated.
Using the loopback functionality ,you would only be able to monitor the output of the TX pin, the RX pin is disregarded.
So, if you want to generate the pair of RX and TX signals you may want to test with our MCAN_interrupt example. But here you will need two boards.
Let me know if I could help you further.
Diego
@diego_charlesyes please.
OK, but then I can't generate a CAN signal itself, i.e. using the MCP 2551 to obtain from TX the CANH and CANL ?
When using external loop back mode, an attached driver would still generate a proper CAN bus signal. You cannot use a device in loop back mode on a real CAN bus, though.
The loop back mode is useful for device-internal testing only. You cannot validate the correct baudrate, sample timing, correct wiring, and termination with this mode.
OK, so would you know how I could do it?
Not sure what you mean, but even with external loop back mode, you could see the CANH / CANL signals on a transceiver attached to Tx. You cannot receive CAN messages from other nodes in loop back mode, though.
To get a CAN environment running from ground up, I would suggest two boards (preferably of the same type), and the following steps:
1. get the loop back example running, perhaps adapt it for external mode and observe the bus signals
2. Get a proper CAN example running (e.g. the suggested interrupt example) on both boards, and connect them directly (Tx / Rx / GND directly, without transceiver).
3. Add the transceivers to both nodes.
@frank_m Well, it doesn't work for me.
I'm using the MCP2551 to send data and I'm trying to read CANL and CANH and it's not working.
Do you see the Tx signal at the Tx pin ?
And at the MCP2552 input pin ?
And the transceiver is a 5V device, not 3.3V.
Yes, I got it working, a hardware problem, thanks.
Is there a way to verify that the plot has been sent correctly and that the master CAN has understood it?
Thank you very much.
Best regards
You probably mean the message.
There is an acknowledge bit somewhere in the protocol. If sending fails, you should see the Tx error counter (a register in the CAN peripheral) see going up. Usually by 8 counts per message. Id not everything was fine...
CAN has no master/slave architecture, it is strictly message-based. The message ID determines the priority. There are several decent CAN tutorials you could check out.
BTW, pure CAN is rarely used nowadays. Most application use higher-level protocols like CANopen or J1939, with plenty of commercially available devices. My company's ECUs support CANopen.
Thank you very much for your quick response.
I need to use pure CAN, I will watch some tutorial if.
If I have not misunderstood you, it is impossible to know from the MCU that sends the message if it was all correct right?
Thank you very much again.
Best regards.
Hi @Nadia
Complementing Frank's comments regarding the TX error fail. There are TX and RX error counters that every can controller has. This FAQ is good giving a mini overview of them https://community.nxp.com/t5/LPC-FAQs/How-do-the-error-counters-work/m-p/590735
On every failed receive of a frame the receive counter is increased and on every successful receive it is decreased.
On every failed transmit of a frame the transmit counter is increased and on every successful
transmit it is decreased.
I am not complete sure what do you mean with "all was correct" , but According to the BOSCH's CAN specification there are 5 kinds of errors, see http://esd.cs.ucr.edu/webres/can20.pdf#page=25 that are divided at message level and bit level. "Those are the errors that a transmitter and a receiver will check depending on the situation.
I hope it could help
Diego.
I avoided going into much CAN details here, there would be too much to cover here potentially ...
But to observe CAN bus events, you can debug your MCU, and check for CAN peripheral flags and events. Consult the MCU user manual for details.
And secondly, I would highly recommend some analysing/monitoring equipment. The Vector equipment is good, but a bit pricey. There exist cheaper alternatives that can do the job in many circumstances.
My company uses a lot of PEAK stuff (www.peak-system.com), besides of Vector tools.