Need CAN explanation Topic is solved
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
- arbulgazar
- Posts: 8
- Joined: Sun Dec 16, 2018 5:12 pm
- Has thanked: 1 time
Need CAN explanation
Greetings, I am new to the whole CAN thing and am trying to use it for my STM32F407 Discovery board project. I am looking at testhal\STM32\STM32F4xx\CAN example project and can't understand how to figure out and set-up exact pins that CAN driver will be using. From my board's datasheet I see that there are alternative options available in terms of CAN pinout (PA11 & PA12 vs PD0 & PD1 for example). How do I select one of them to be used by driver? Do I just modify alternate functions for pins of interest in the board.h?
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Need CAN explanation Topic is solved
Hi,
Correct, if you use ChibiStudio you need to generate a new board.h starting from the .chcfg file (it is an XML description of pin settings), you may copy the board directory into your project and customize it.
If you don't use ChibiStudio then you can edit board.h directly, again, it is better to create board files into the project.
Search on playembedded.org for info, there are tutorials covering this.
Giovanni
Correct, if you use ChibiStudio you need to generate a new board.h starting from the .chcfg file (it is an XML description of pin settings), you may copy the board directory into your project and customize it.
If you don't use ChibiStudio then you can edit board.h directly, again, it is better to create board files into the project.
Search on playembedded.org for info, there are tutorials covering this.
Giovanni
- arbulgazar
- Posts: 8
- Joined: Sun Dec 16, 2018 5:12 pm
- Has thanked: 1 time
- arbulgazar
- Posts: 8
- Joined: Sun Dec 16, 2018 5:12 pm
- Has thanked: 1 time
Re: Need CAN explanation
Sorry for raising this topic again, but I can't figure out how to work with the driver. I configured the board using the .chcfg file to use GPIOB8 as CAN1_RX and GPIOB9 as CAN1_TX (Alternate mode, alternate function 9 as in datasheet) for 2 boards that I have. I am trying to make 2 STM boards communicate, and connected those with 2 jump-wires PB9 to PB8, PB8 to PB9 respectfully.
Now on one board, I disabled TX thread, but the RX thread led is not blinking, so it's not receiving the message I assume. And removed loop back mode from both configurations. Is there something I am missing in driver configuration to make it work with the pins I assigned?
Now on one board, I disabled TX thread, but the RX thread led is not blinking, so it's not receiving the message I assume. And removed loop back mode from both configurations. Is there something I am missing in driver configuration to make it work with the pins I assigned?
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Need CAN explanation
Hi,
How do you connect the boards? do you have CAN transceivers? are those GPIOs available on the board?
Giovanni
How do you connect the boards? do you have CAN transceivers? are those GPIOs available on the board?
Giovanni
- arbulgazar
- Posts: 8
- Joined: Sun Dec 16, 2018 5:12 pm
- Has thanked: 1 time
Re: Need CAN explanation
Hello Giovanni,
Thanks for the help!
GPIOs are available on the board, however, I do not have transceivers yet, figured it out already. I thought that if board supports CAN - they are built-in in the board. But reading board specification more carefully, it's said that I need the transceivers, so that is the problem.
For learning purposes though - how driver figures out which pins to use? Board-specific configuration makes sure it is sending the signal to all eligible GPIOs?
Kind regards,
Max
Thanks for the help!
GPIOs are available on the board, however, I do not have transceivers yet, figured it out already. I thought that if board supports CAN - they are built-in in the board. But reading board specification more carefully, it's said that I need the transceivers, so that is the problem.
For learning purposes though - how driver figures out which pins to use? Board-specific configuration makes sure it is sending the signal to all eligible GPIOs?
Kind regards,
Max
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Need CAN explanation
Hi,
In our HAL drivers are not aware of GPIO settings, those are left to the application using the PAL API or board files.
Rationale is: GPIO assignments change from device to device, we don't want to bring that complexity into each and every driver.
Giovanni
In our HAL drivers are not aware of GPIO settings, those are left to the application using the PAL API or board files.
Rationale is: GPIO assignments change from device to device, we don't want to bring that complexity into each and every driver.
Giovanni
Who is online
Users browsing this forum: No registered users and 40 guests