Comments (13)
I received your email.
from arduino-stm32-can.
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.
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.
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.
- 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.
@nopnop2002 is there a way I could write You a privet message?
from arduino-stm32-can.
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.
Perfect. I'm waiting for Your email then
from arduino-stm32-can.
I'm going to reveal it now, but are you ready?
from arduino-stm32-can.
yes :)
from arduino-stm32-can.
got it
from arduino-stm32-can.
Please send me an email with just the title to confirm that the address is correct.
from arduino-stm32-can.
I've already sent You with the title of this issue and info.
from arduino-stm32-can.
I added.
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
- 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.