nopnop2002 / arduino-stm32-can Goto Github PK
View Code? Open in Web Editor NEWCan Example for Arduino Core STM32
Can Example for Arduino Core STM32
Is it possible to add support for stm32f105 with two cans?
Hi,
Firstly - thank you for the project, very nicely documented.
Just wondering if you have some examples for CANSetFilter ?
I'm trying to filter messages from ID 0x681 AND the first byte of the message 0x03
So this works fine for filtering all messages from 0x681
CANSetFilter(0, 1, 0, 0, 0x681 << 21, 0xFFE00000);
So I expected this would work for what I was trying to achieve:
CANSetFilter(0, 1, 0, 0, 0x68103 << 13, 0xFFFFE000);
But I'm still receiving all messages to 0x681 with this which is odd.
when i use CANInit(CAN_500KBPS, 3);
always return false;
i guess can init failed.
the same issue when i change parameter,like CANInit(CAN_1000KBPS, 3); or CANInit(CAN_500KBPS, 2);
can you help? thanks
Hi,
great work! I successful can receive can-messages but if I send a message I get the error "Send fail" on serial interface and nothing seems to be sent.
I am working on STM32F103/ SN65HVD230. Do have an idea why? Termination resistor seems not the reason. Same can-bus with ESP32 is also working.
Kind regards,
Max
I am getting send fails on a custom board using the STM32F405 code. I had everything working on a Bluepill STM32F103. It isn't the terminating resistors. If I am using an external HSC XTAL, do I have to change anything in the code?
I can use the same test rig (Microchip CAN Analyzer, harness, resistors, etc) on my bluepill based prototype and it works fine.
I can't think of anything else. I am using CAN1 only on PB8 and PB9. Transceiver is SN65HVD230. The code initializes it fine in the CANinit function.
// CAN1
RCC->AHB1ENR |= 0x2; // Enable GPIOB clock
CANSetGpio(GPIOB, 8); // Set PB8
CANSetGpio(GPIOB, 9); // Set PB9
All my other peripherals (TFT, I2C EEPROM) all work fine. Here is my HAL clock config that I used STM32CubeIDE to find.
extern "C" void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Configure the main internal regulator output voltage
*/
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
/** Initializes the RCC Oscillators according to the specified parameters
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK)
{
Error_Handler();
}
}
Hello
Can you help me figure out why this project is not working for me
It compiles successfully and get uploaded successfully by stlink swd connector
But doesn't send any messages
The board doesn't work using usb doesn't get recognized so i can't see uart or debug info
I tested on version 2.2 of Arduino,but it didn't work well.I used stm32f103vet6
In the Raspberry Pi wiring example, the MCP2551 is connected to 3V, but that chip only supports 5V.
Can you change that example, so that people do not run into connection issues due to wrong wiring?
Not really issue, but still. I would like to know how you have calculated the bit timings, so I could calculate those for other F4 boards too that have different clock frequency. Like F401 and F411
Hi sir i wanted to ask you someting I want to use UAVCAN to connect my stm32f4 to autopilot. I was trying to use your codes in canard example but I couldnt understand how. i downloaded the file and opened example.ino but that code does nothing. Can you explain to me how to do it?
Hi! How to add this files to arduino ide?
Hi,
We are using your CAN library on our STM32F446RE board to read CAN messages.
If we send one message from a different board, this message is received up to six times on the receiving side.
Sometimes, the message isnt received at all.
The sending side is running on a different microcontroller using CAN hardware that has been proven to be stable over the last two years. The receiving side is using the library provided in this git repo.
What clock crystal were the bit timings calculated with? We are using a 8MHz HSE crystal, do we need to adjust the bit timings?
Hi, ı want to receive messages from arduino mega with canbus on stm32f407. When upload code it says CAN initilization is succesfull but doesnt receive anything. Arduino prints sending is succesfull. But I cant figure out why it doesnt work. And I counldnt find your Sender Codes anywhere, are they avaliable?
Hi, currently using STM32F103R8T6.
CAN interface is connect like:
PB8 -> CAN_RX -> TJA1050
PB9 -> CAN_TX -> TJA1050
in void Setup I'm using:
bool ret = CANInit(CAN_500KBPS, 2); // CAN_RX mapped to PB8, CAN_TX mapped to PB9
What happens is that while debugging i notice that on this line, the while loop never ends.
Communication works ok outside this unit. Am i missing something?
Hello
I appreciate the effort done in this project. I have a problem with compilation of stm32f103.ino
I got this error:
"C:\Users\XXXXX\Documents\Arduino\libraries\stm32f103\stm32f103.ino: In function 'void CANReceive(CAN_msg_t*)':
stm32f103:242:8: error: 'id' was not declared in this scope
242 | if ((id & STM32_CAN_RIR_IDE) == 0) { // Standard frame format
| ^~
stm32f103:251:8: error: 'id' was not declared in this scope
251 | if ((id & STM32_CAN_RIR_RTR) == 0) { // Data frame
| ^~
exit status 1
'id' was not declared in this scope"
I have Arduino IDE 1.8.12
and latest version of STM32duino
hello, first thanks for your work!
Maybe for usability and to simplify the code for the enduser, convert to a library? So that the main code dont get overload with background tasks. Only include the lib, init the CAN and call constructors like ReadCan or SendCan in the loop.
Hello nopnop2002,
Thanks for your create work.
I want do adapt your code to a board using the stm32f767 but I don't know how to get this done. Could you provide me some information which code is specific for the processor? Where did you get the information to support the other processors?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.