Giter Site home page Giter Site logo

Comments (13)

nopnop2002 avatar nopnop2002 commented on July 22, 2024 1

I received your email.

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on July 22, 2024

The currently supported STM32F405/407 microcontrollers run at 168MHz.
The STM32F413/423 microcontrollers run at 100MHz.
This difference requires changing this value for STM32F413/423 microcontrollers.

https://github.com/nopnop2002/Arduino-STM32-CAN/blob/master/stm32f407/stm32f407.ino#L29

Since I don't have an STM32F413/423 microcontroller,
I can't show you how to change it.

from arduino-stm32-can.

pawkon avatar pawkon commented on July 22, 2024

There is a site : http://www.bittiming.can-wiki.info/ on which we could calculate the timing.

From Reference Manual : All peripheral clocks are derived from the system clock (SYSCLK) except for USB OTG FS, I2S nad I2C

So for 100MHz bittiming should be like this (CAN_BTR):

1Mbps = 0x00070009 500kbps = 0x00070013 250kbps = 0x001c0018 125kbps = 0x001c0031 100kbps = 0x00070063 50kbps = 0x001c007c 20kbps = 0x000701f3 10kbps = 0x001c0270

So how to adopt it for Your code as You use TS1&2 and BRP? I have a working CAN-BUS with STM32F103 BluePill so I can do a tests

Is this the only one parameter to change in Your code?

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on July 22, 2024

Use these two lines of code to set the BTR register.

https://github.com/nopnop2002/Arduino-STM32-CAN/blob/master/stm32f407/stm32f407.ino#L220

https://github.com/nopnop2002/Arduino-STM32-CAN/blob/master/stm32f407/stm32f407.ino#L224

STM32 uses three values ​​TS2, TS1 and BRP to configure the BTR register.

Examine these three values ​​and set them in the can_configs variable.


Is this the only one parameter to change in Your code?

You should read the reference manual carefully.

https://www.st.com/resource/en/reference_manual/rm0430-stm32f413423-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

  • Find out how to configure GPIO power control in the RCC chapter..
  • Find out how to configure the CAN port in the GPIO chapter.
  • Find out how to use the filters and how to use registers related to CAN in the bxCAN chapter.

And reflect the result of the examination in the code.

STM32F407 and 413 may be the same code.

Or it could be a completely different code.

Or it could be partly the same code and partly different code.

You won't know this until you look into it.


STM32 has multiple functions in one port.
This is called the alternative function of port.
Ports that can be used as CAN are limited.

For example, PA11 on STM32F405/407 is GPIO by default, but can be switched to USART1_CTS or CAN1_RX functionality.
To use PA11 as CAN1_RX, you need to switch the alternative function of the port to CAN1_RX.

For example, STM32F405/407 has two systems of CAN1/CAN2, and you can switch CAN ports as follows.

CAN1_RX mapped to PA11, CAN1_TX mapped to PA12
CAN2_RX mapped to PB5 , CAN2_TX mapped to PB6

CAN1_RX mapped to PB8 , CAN1_TX mapped to PB9 (not available on 36-pin package)
CAN2_RX mapped to PB12, CAN2_TX mapped to PB13(not available on 36-pin package)

CAN1_RX mapped to PD0 , CAN1_TX mapped to PD1 (available on 100-pin and 144-pin package)
CAN2_RX mapped to PB12, CAN2_TX mapped to PB13(not available on 36-pin package)

This configuration also cannot be understood without reading the datasheet.

Here is the STM32413ZH datasheet.

https://www.alldatasheet.com/datasheet-pdf/pdf/885152/STMICROELECTRONICS/STM32F413ZH.html

From here, explore the alternate functions of each port to find the settings for use as CAN.

STM32F407 and 413 may be the same alternative functions.

Or it could be a completely different alternative functions.

You won't know this until you look into it.

It is hard work.

from arduino-stm32-can.

pawkon avatar pawkon commented on July 22, 2024

@nopnop2002 is there a way I could write You a privet message?

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on July 22, 2024

By arranging a time with you, I can publish my private address here.

I will delete the message as soon as you read it.

from arduino-stm32-can.

pawkon avatar pawkon commented on July 22, 2024

Perfect. I'm waiting for Your email then

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on July 22, 2024

I'm going to reveal it now, but are you ready?

from arduino-stm32-can.

pawkon avatar pawkon commented on July 22, 2024

yes :)

from arduino-stm32-can.

pawkon avatar pawkon commented on July 22, 2024

got it

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on July 22, 2024

Please send me an email with just the title to confirm that the address is correct.

from arduino-stm32-can.

pawkon avatar pawkon commented on July 22, 2024

I've already sent You with the title of this issue and info.

from arduino-stm32-can.

nopnop2002 avatar nopnop2002 commented on July 22, 2024

I added.

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.