2017-12-20 09:49 AM
Hello,
I'm trying to bring up the CAN bus on the STM23F303RE nucleo board and am having some difficulty determining which way to go. I've been unable to find a HAL library example for this platform. Can anyone point me to one? I have found a HAL example for the STM32F4 but that target has different peripherals.
Also, I see three different possible design approaches for this project. It's a fairly simple control loop that we're developing. The 3 options seem to be:
1. Code system using HAL library.
2. Use STMCube for development (but why is there no CAN example for STMCube and the STM32F3xx?)
3. I see the ARM-Mbed program but am not familiar with the benefits or roadblocks of using that RTOS. (I don't think we need an RTOS)
Thanks for any suggestions here.
- Dave
#can-bus-stm32f3032017-12-21 06:50 PM
The Nucleo board has no dip switches. I’ve not found any docs about it. I’m sure they are there but I haven’t found them.
Sent from my iPhone
2017-12-21 07:01 PM
You can mimic a dip switch on the nucleo board by setting some pins to input with pull ups turned on,
putting these pin low to read 0s
Edit:
the easiest way through to success is to use a third party, known good data source.
I purchased a CanDo unit, and started sending frames, then I got my receiver working first...
then I worked to transmit to the CanDo.
using port pins for the addressing.
2017-12-21 07:02 PM
His board has DIP switches, assume it's not a Nucleo.
Run a different program on each. Typically when testing CAN you want a Transmitter App on one board, and a Receiver App on the other, to acknowledge traffic. ie one sends 0x123 messages, the other filters/listens for 0x123 messages.
It isn't an Address, all boards see the same traffic, you can set a filters to select which ID messages you want to process. ie in a car the window motor doesn't need to receive the oil temperature, but all windows might want to hear a home message.
2017-12-22 04:50 PM
Thanks for the info. It’s not a simple protocol/implementation. I thought that the networking example could be run on both boards. Pressing a button on either board would transmit a message on the bus and the other boards would catch it. (Would the transmitter see its own message?)
I’m working at wiring the Nucleo boards to the L9616 CAN bus transceiver. It looks like it should be trivial but the first hurdle is to figure out orientation of the chip! The docs show a standard dot or indent on the corner of chip to indicate pin 1 but none of my chips have any pin 1 indication. I’ve got a 50% chance to get it right.
So, I wired TX and RX from the Nucleo to the transceiver but it is not working as expected. When I transmit a CAN package, the TX, RX, C-HI and C-LO all show the same squarewave waveform. Should I see the TX signal on the RX pin? (Maybe so since it’s out on the bus) And I would expect the sign of the C-HI and C-LO to be opposite. Is this correct? I do not have 120 ohm terminating resistors but I wouldn’t think I need them for a small bench-top test. Also, what level should the Reference Voltage pin be held at on the L9616? I did not see that in the technical specs manual.
I have the CL/CH output of the CAN transceiver going to a USB/CAN tool and it doesn’t detect a CAN device on the network…
Any suggestions appreciated.
Thanks,
________________ Attachments : image001.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyES&d=%2Fa%2F0X0000000b4t%2FCLqMX5MZHnzsy2mxZ_lYX9A9cBZseGSRnLOD7tCiKVE&asPdf=false2017-12-22 05:46 PM
Please check the
beveled edge
on the chip.. you must know the orientation.Sounds like you have lost your ground reference, maybe the chip is backwards...To check your transceiver,
Start your USB/Can unit transmitting frames...
can you check it on the scope ?
The 120R is not needed for bench work. if you check the scope, you wont see ringing due to the light weight of the short copper wires.
on the transceiver chip, you should see traffic on the Rx pin, and not on the Tx pin or ground pin.
I guess the Rx1 pin is for noisy circuits. It is an output, so a 0.1uF cap I guess.. There must be an application note.
2017-12-26 12:05 PM
Thanks. I didn't notice the bevel. The bevel is on the pin 1 side. Now I'm finally getting a double ended signal from the CL/CH output from the L9616! Interestingly, I had to connect the Tx pin from the STM32 to the RX pin on the L9616 and vice versa (RX on STM32 to TX on 9616).In the CAN configuration I have:
/* Definition for USARTx Pins */
&sharpdefine CANx_TX_PIN GPIO_PIN_11&sharpdefine CANx_TX_GPIO_PORT GPIOA &sharpdefine CANx_TX_AF GPIO_AF9_CAN&sharpdefine CANx_RX_PIN GPIO_PIN_12&sharpdefine CANx_RX_GPIO_PORT GPIOA&sharpdefine CANx_RX_AF GPIO_AF9_CANI have the output from the CL/CH output from the 9616 going to a Ginkgo USB-CAN interface adapter (and ground). The adapter does not recognize a second CAN device yet. (the first is the adapter itself apparently) I have a couple of observations which I'm not sure are correct. First, I get the same pulse train on both the TX and RX pins of the STM32. Second, as I mentioned, I get the double ended signal at the CL/CH output from the transceiver. However, when I try to send a packet from the USB-CAN adapter, I see no activity on the CL/CH lines of the transceiver. That's probably because the adapter has yet to detect the device but I'm not sure.
Thanks for any ideas on getting this system up and communicating.
2024-03-23 07:06 PM
Hello, David. I have a STM32F303 connected to a L9616 and I can transmit to the CAN bus, but Despite all the effort I could not get the reception callbacks fired. The 9616 Vs pin is connected to 5V instead of 3.3V and I suspect this is why the STM32 CAN Rx pin is at 5V.
Can you please share your connection diagram between STM32 and L9616 with me? Could you make your device work as expected?
Best regards,
Hering
2024-03-24 02:56 AM
Hello @enhering ,
Could you please open a new thread as this one is very old and the member who you are looking for to help could no more available in the community.
Other members in this community can assist you ..
Thank you.