Comments (10)
This is the configuration I selected.
from arduino-stm32-can.
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.
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.
Possible reasons
bluepill does not have a CAN transceiver.
from arduino-stm32-can.
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.
blue pill itself has CAN controller support.
you need CAN transceiver.
https://github.com/nopnop2002/Arduino-STM32-CAN#wirering
from arduino-stm32-can.
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.
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
It may break when CAN Low and CAN High are connected.
from arduino-stm32-can.
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.
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.
from arduino-stm32-can.
Related Issues (20)
- the lib didn't work well HOT 4
- Send Fail HOT 16
- Canard HOT 1
- Possible to read but can't send data. HOT 28
- Raspberry Pi wiring example issue HOT 1
- CAN messages dropped, sometime receiving message up to six times HOT 9
- STM32F103C8T6 hangs on CANInit(CAN_1000KBPS, 2) HOT 3
- STM32F103 gets stuck inside while (!(CAN1->MSR & 0x1UL)); HOT 26
- Send Fail on STM32F407VE HOT 15
- how is Serial and CAN being used simultaneously in STM32F103? HOT 3
- STM32F413ZH NUCLEO-F413ZH HOT 13
- CAN on STM32G4 series HOT 1
- Discuss: other ways to clear mailbox? HOT 1
- Mistake in Line 277 HOT 5
- STM32F042F6P6TR HOT 1
- feature request: support multiple transmit mailboxes HOT 12
- BARTH STG-850 Support HOT 5
- Unable to communicate STM32f103 vs ESP32 via CAN BUS HOT 2
- Sending data issue HOT 9
- dlc bigger than 8 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-stm32-can.