Git Product home page Git Product logo

exocan's People

Contributors

exothink avatar trebornide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exocan's Issues

CAN2

Would you have any interest in implementing CAN2 in your library for the stm32F105/107?

I have managed to get CAN2 working (as a stand-alone functions) , working along side your library on a stm32F105. I told Arduino IDE that the board was a blue pill and it was happy. (It had frequent upload timeouts - I think because on the 105 & 107 you can use any port for uploading so may take longer to scan ?) My code is only basic and doesn't take advantage of all the features your library does.

You are welcome to my code but it is mostly based on your work.

transmit sends the data but never returns

I'm trying to get two bluepill boards to communicate with each other using this library. When one bluepill sends a frame to the bus, it's actually getting transmitted (the other bluepill recieves the data correctly and I can see that ACK is being sent on the bus (I'm sniffing the bus using a logic analyzer). However transmit() completely hangs the sending microcontroller and I have to reset it using the microswitch on board. Using some digitalWrite's I tracked down the line that hangs the uC and it's the last line before return (that is: periphBit(ti0r, 0) = 1).

I'm sure my bluepill boards don't have genuine STM32 (probably a CS32F103c8t6 but I'm not sure) on it as I had to add upload_flags = -c set CPUTAPID_0x2ba01477 to the config to work. Do you have a board with the same chip to test if it works for you?

SN65HVD230 support

Even thou I'm not user of this library, I've came across it while searching why my SN65HVD230 does not work. I have the same cheap knock-off from Ali.
Problem was 10 kΩ resistor, tying Rs (8) pin to ground, while the Rs should be tied to the ground directly.

From datasheet:

The RS pin (pin 8) on the SN65HVD230 and SN65HVD231 provides three different modes of operation: high
speed mode, slope control mode, and low-power mode. The high speed mode of operation is selected by
connecting the RS pin to ground, allowing the transmitter output transistors to switch on and off as fast as
possible with no limitation on the rise and fall slopes. The rise and fall slopes can also be adjusted by connecting
a resistor in series between the RS pin and ground. The slope will be proportional to the pin's output current. With
a resistor value of 10 kΩ the device will have a slew rate of ~15 V/μs, and with a resistor value of 100 kΩ the
device will have a slew rate of ~2 V/μs.

Solution: Remove 10 kΩ resistor (R1 on my module), and connect it directly (0 Ω resistor, piece of wire or good amount of solder will do). This puts chip in the high performance mode, and viola, it started to work.

If you want, you can do a test.

compilation error on VSCODE+PlatformIO+stm32 platform - u_int32_t type definition missing

Bellow error is present when compiling in VSCODE + PlatformIO against a STM32 bluepill

.pio\libdeps\bluepill_f103c6\eXoCAN/eXoCAN.h:146:41: error: 'u_int32_t' has not been declared
146 | void filter32Init(int bank, int mode, u_int32_t a, u_int32_t b); //32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN/eXoCAN.h:146:54: error: 'u_int32_t' has not been declared
146 | void filter32Init(int bank, int mode, u_int32_t a, u_int32_t b); //32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN/eXoCAN.h:158:35: error: 'u_int32_t' has not been declared
158 | void filterMask32Init(int bank, u_int32_t id = 0, u_int32_t mask = 0);
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN/eXoCAN.h:158:53: error: 'u_int32_t' has not been declared
158 | void filterMask32Init(int bank, u_int32_t id = 0, u_int32_t mask = 0);
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN/eXoCAN.h:159:35: error: 'u_int32_t' has not been declared
159 | void filterList32Init(int bank, u_int32_t idA = 0, u_int32_t idB = 0); // 32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN/eXoCAN.h:159:54: error: 'u_int32_t' has not been declared
159 | void filterList32Init(int bank, u_int32_t idA = 0, u_int32_t idB = 0); // 32b filters
| ^~~~~~~~~
In file included from .pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.cpp:1:
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.h:146:41: error: 'u_int32_t' has not been declared
146 | void filter32Init(int bank, int mode, u_int32_t a, u_int32_t b); //32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.h:146:54: error: 'u_int32_t' has not been declared
146 | void filter32Init(int bank, int mode, u_int32_t a, u_int32_t b); //32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.h:158:35: error: 'u_int32_t' has not been declared
158 | void filterMask32Init(int bank, u_int32_t id = 0, u_int32_t mask = 0);
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.h:158:53: error: 'u_int32_t' has not been declared
158 | void filterMask32Init(int bank, u_int32_t id = 0, u_int32_t mask = 0);
| ^~~~~~~~~
Compiling .pio\build\bluepill_f103c6\FrameworkArduino\VirtIOSerial.cpp.o
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.h:159:35: error: 'u_int32_t' has not been declared
159 | void filterList32Init(int bank, u_int32_t idA = 0, u_int32_t idB = 0); // 32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.h:159:54: error: 'u_int32_t' has not been declared
159 | void filterList32Init(int bank, u_int32_t idA = 0, u_int32_t idB = 0); // 32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.cpp:129:41: error: 'u_int32_t' has not been declared
129 | void eXoCAN::filterList32Init(int bank, u_int32_t idA, u_int32_t idB) //32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.cpp:129:56: error: 'u_int32_t' has not been declared
129 | void eXoCAN::filterList32Init(int bank, u_int32_t idA, u_int32_t idB) //32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.cpp:135:41: error: 'u_int32_t' has not been declared
135 | void eXoCAN::filterMask32Init(int bank, u_int32_t id, u_int32_t mask) //32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.cpp:135:55: error: 'u_int32_t' has not been declared
135 | void eXoCAN::filterMask32Init(int bank, u_int32_t id, u_int32_t mask) //32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.cpp:140:47: error: 'u_int32_t' has not been declared
140 | void eXoCAN::filter32Init(int bank, int mode, u_int32_t a, u_int32_t b) //32b filters
| ^~~~~~~~~
.pio\libdeps\bluepill_f103c6\eXoCAN\eXoCAN.cpp:140:60: error: 'u_int32_t' has not been declared
140 | void eXoCAN::filter32Init(int bank, int mode, u_int32_t a, u_int32_t b) //32b filters
| ^~~~~~~~~
*** [.pio\build\bluepill_f103c6\src\main.cpp.o] Error 1
*** [.pio\build\bluepill_f103c6\lib89b\eXoCAN\eXoCAN.cpp.o] Error 1

send more than 1 CAN message in a row

Hello

Is it possible to send more than 1 Can message in a row (without delay) and without data being lost at the recipient? How can this be implemented properly?

void canISR() // get CAN bus frame passed by a filter into fifo0
{
    can.receive(id, fltIdx, rxbytes);  // empties fifo0 so that another another rx interrupt can take place
}

void setup()
{
  can.attachInterrupt(canISR);
}

void loop()
{
...
...
    can.transmit(frame1...);
    can.transmit(frame2...);
    can.transmit(frame3...);
    can.transmit(frame4...);
    can.transmit(frame5...);
...
}


Thank you

Compiling on PlatformIO on Linux

Hi. Thanks for the library it is just what I needed for my project. There are so few examples of using canbus on STM32 out there. This library is invaluable.

I did find the library would not compile using PlatformIO on Linux because of line 25 in eXoCAN.h
#include <arduino.h>

The 'A' needs to be capitalised
#include <Arduino.h>

The other thing I noticed is that the timeout in the function eXoCAN::transmit() is commented out. Is there a reason for this?
With the transmit FIFO being only three messages long in the STM32F103C8 it is useful to wait for a space in the FIFO when sending a cluster of messages.

Bitrate of 100K?

Great work, thank you! Can you please tell me what has to be modifed for a bitrate of 100K? I have an already existing system I want to connect to. And is it possible to use CAN at PB8+9 and also PA11+12 via USB on "BluePill" for a serial output at the same time?

Regards,
Max

extendid bit identifier

For standard ID , I can specify STD_ID_LEN as a parameter in can.begin() , Can I please know how to use extended bit identifier??

Filter with extend mask

I can't get the extended id and filtering to work.
Example:

can.filterMask32Init (0, 0x00232461,0x1FFFFFFF);
using eXoCAN can(EXT_ID_LEN, BR1M, PORTA_11_12_WIRE_PULLUP);

it should filter everything except 0x232461 ... but it doesn't work as expected. Nothing is received, 0x232461 is filtered.

Using 2 CAN buses simultaneous

I saw that there are 2 can buses within the bluepill. Is it possible for me to initialize and use both of them simultaneously ?

Init with USB or CAN

I know CAN and USB can't work at the same time.
Is there a method to switch between CAN and USB in runtime?
On my hardware I can detect the USB-Bus power, so I know if the HW is connected via USB or not.
I'd like to load the CAN functions only if not connected to USB.
At the moment the constructor
eXoCAN can;
already kills USB. Any suggestions?

ID

Hello,
I am using your library to send message to Canbus net. I use three ID address as shown in picture.
I can sent message successfully with three ID. But the id address changed when i receive the message from canbus net. You can see that from the picture.
Any idea how this happended??

THANK YOU!
未命名

eXoCAN

Hi
I want to send 8 byte fixed data to id=0x0 and read 8 byte variable data from id=0x2bd .
Please guide me . Thanks

Remote frame

Hi John,
how can I send a remote frame? Couldn't figure it out neither from the .h-file nor from examples. Maybe you could give a hint in your README.
vy 73, Hermann, DF2DS

USB Serial not working after upload

Until now I was using mcp 2515 for CAN transmission. I wanted to give a try to mcp2551 as blue pill has built in support of CAN.
Manged to add your library to Arduino IDE and uploaded example sketch.
After uploading I don't have usb serial any more.
Is it possible to have CAN and usb serial at same time?
I have tried both PORTA_11_12_WIRE_PULLUP and PORTB_8_9_WIRE_PULLUP. Nothing helps.
When I upload any other sketch usb works fine.

Arduino IDE: 1.8.13
Board core:
https://github.com/stm32duino/BoardManagerFiles/raw/master/package_stmicroelectronics_index.json

The library is not working, please correct.

Bluepill STM32F103C8T6 generic_boot20_pc13

  1. Doesn't find the required library by the eXoCAN keyword, you have to download a zip archive from GitHub
  2. Used variables u_int32_t that do not work in the repository
    http://dan.drown.org/stm32duino/package_STM32duino_index.json
    they work in the slow and fat library at the link
    https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
    the same thing with the bpCanBlink.ino example, digitalToggle () does not work in it
    Solution: replace 12 variables with uint32_t, use digitalToggle -> static void instead
  3. Immediately upon the declaration of the can class, the processor goes into idle state. Problem in recursive begin declaration. file eXoCAN.h dates 150, 151 I commented out them.
  4. I don't know if it can be so correct, but 2 identical names are used in the same begin class with different functionality, which I also corrected for begin1
  5. Init passes only in the case of PORTB_8_9, but in both cases serial falls off due to the clock initialization lines, eXoCAN.cpp lines 82-92, yes, I understand that USB on PA 11 and 12 legs, but the controller completely freezes if they are assigned in the eXoCAN library ...
  6. After all these fixes, I managed to send one message using the can.transmit () command, after which the unused PC13 output (LED) turned on and the controller continued to work in loop () without sending it to transmit and Serial not working.

There is no debugging on this Arduino software, so I was very disappointed that I could not start CAN with the USB library. Now I have to use Cub for my task, but so far I have not come up with a beautiful solution with a bootloader.

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.