Giter Site home page Giter Site logo

Comments (10)

mamech avatar mamech commented on August 24, 2024

image
This is the configuration I selected.

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on August 24, 2024

Your code doesn't have this line.

It's different from the github code.

https://github.com/nopnop2002/Arduino-STM32-CAN/blob/master/stm32f103/stm32f103.ino#L243

from arduino-stm32-can.

mamech avatar mamech commented on August 24, 2024

Thank you very much. now compiled successfully.
But I faced a new problem. The program gets stuck in Setup() function and does not continue to loop() function for unknown reason.
void setup() { Serial.begin(115200); Serial.println("Hi 1"); bool ret = CANInit(CAN_100KBPS, 3); Serial.println("Hi 2"); if (!ret) while(true); Serial.println("Hi 3"); }

Only "Hi 1" is printed. so this means to me that this line :
bool ret = CANInit(CAN_100KBPS, 3);
is blocking the code for some reason, so code stucks inside CANInit() and does not come out of it. I tried to change the second argument of CANInit() to 0,1,2 and all are the same, the program stucks.
I am using Bluepill.

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on August 24, 2024

Possible reasons

bluepill does not have a CAN transceiver.

from arduino-stm32-can.

mamech avatar mamech commented on August 24, 2024

I think you mean the blue pill was not connected to CAN transceiver during this test?
The answer is yes, but blue pill itself has CAN controller support, so why do I need a transceiver? And how a hardware transceiver causes the code to get stuck?

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on August 24, 2024

blue pill itself has CAN controller support.
you need CAN transceiver.

https://github.com/nopnop2002/Arduino-STM32-CAN#wirering

from arduino-stm32-can.

mamech avatar mamech commented on August 24, 2024

Thanks for clarification. I tried to make like echo test using one blue pill and transceiver, but did not work either and still stuck at the same line. I am wondering is it a must to have 2 blue pills with 2 transceivers? can not I use only onle blue pill with CANHigh connected to CANLow so I receive the same message I sent?

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on August 24, 2024

it a must to have 2 blue pills with 2 transceivers.

CAN is not TR / RX.

Dominant / Recessive is expressed by the voltage difference between CAN HIGH and CAN LOW.

https://www.ti.com/lit/an/slla337/slla337.pdf

https://www.ti.com/lit/an/sloa101b/sloa101b.pdf?ts=1627823619752&ref_url=https%253A%252F%252Fwww.google.com%252F

It may break when CAN Low and CAN High are connected.

from arduino-stm32-can.

mamech avatar mamech commented on August 24, 2024

Thanks, now it is clear. It is first time I use CAN so I am influenced much with UART.
One more question please, CAN network should have master and slave, so these 2 bluepills should be configuered to be one master and the other is slave, so this leads to 2 questions:
1- The code we are talking about is made to make its bluepill a master or slave?
2- If it is a master how to reverse its function to be a slave (or vice versa) ?
Thanks

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on August 24, 2024

There is no master / slave in the CAN network.

There is just a sender / receiver.

Anyone can be a sender.
Anyone can be a receiver.

However, only one node can be the sender at a particular time.
Multiple nodes cannot be senders at the same time.
The sender may be called bus master.
The sender dominate CAN-BUS.

If a plurality of nodes try to transmit at the same time, only one sender is determined according to the priority.
Low priority nodes give up sending.

The priority is written here.

https://www.ti.com/lit/an/sloa101b/sloa101b.pdf?ts=1627823619752&ref_url=https%253A%252F%252Fwww.google.com%252F

from arduino-stm32-can.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.