Giter VIP home page Giter VIP logo

arduino-stm32-can's People

Contributors

nopnop2002 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  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  avatar

arduino-stm32-can's Issues

Raspberry Pi wiring example issue

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?

hi,my board is stm32f103zet6,have some issues

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

Send Fail

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?

CAN messages dropped, sometime receiving message up to six times

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?

Bit timings

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

Stm32f103 can bus not working

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

Sending CAN fails

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

Problem when compiling stm32f103.ino

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

Possible to read but can't send data.

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?

Can Filters

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.

Adapt to stm32f767 custom board

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?

convert to user-friendly library

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.

Use on STM32F405RGT6 custom board

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

  • in the RCC_OscInitTypeDef structure.
    /
    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
    RCC_OscInitStruct.HSIState = RCC_HSI_ON;
    RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
    RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
    RCC_OscInitStruct.PLL.PLLM = 8;
    RCC_OscInitStruct.PLL.PLLN = 168;
    RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
    RCC_OscInitStruct.PLL.PLLQ = 4;
    if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
    {
    Error_Handler();
    }
    /
    * Initializes the CPU, AHB and APB buses clocks
    */
    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
    |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
    RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
    RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;

if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK)
{
Error_Handler();
}
}

Canard

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?

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.