Olimex Support Forum

ARM => ST => Topic started by: lim on October 19, 2020, 01:52:09 pm

Title: Default CAN-bus Pin-outs but not accessible on Olimex STM32-E407 board
Post by: lim on October 19, 2020, 01:52:09 pm
Can someone help, please? I want to use the default CAN-bus, CAN1-RX, CAN-TX pin-outs respectively on PA11 and PA12. However, there are also shared by OTG_FS_DM(PA11) and OTG_FS_DP(PA12). My question is, can I use them as CAN-bus since they have some electronics components added, refer to the schematic. If the components do not affect the CAN functionality, does that mean I need access them through the OTG micro-USB port?

Very appreciate your answers.

Thank you

Title: Re: Default CAN-bus Pin-outs but not accessible on Olimex STM32-E407 board
Post by: LubOlimex on October 20, 2020, 08:55:18 am
The chip has a lot of multiplexing. Most signals are available on multiple locations. In case of the CAN1 - it can be found on like 4 locations... Aside from PA11 and PA12 it can also be found on PD0 and PD1, also on PB8 and PB9, also on PH13 and PI9.

You should refer to the table with "Alternate function mapping" in the manual of STM32F407.

My advice is to use the PD0 and PD1 pins, these seem very free and are available on the PD connector.
Title: Re: Default CAN-bus Pin-outs but not accessible on Olimex STM32-E407 board
Post by: lim on October 20, 2020, 03:47:10 pm
I have remapped them to PD0 and PD1 respectively. However, Having programmed and tested it, none of the pins got any CAN form signals. Are there any jumpers I need to set? I have re-read the user manual, don't seem to have that. I will check the program again tomorrow. Hopefully, it is my fault.

Any comments are appreciated.

Thank you
Title: Re: Default CAN-bus Pin-outs but not accessible on Olimex STM32-E407 board
Post by: LubOlimex on October 20, 2020, 04:55:37 pm
Just make sure your levels are proper.

We have included CAN option with level transceiver in another design with the same chip - STM32-P407, check its schematic for how CAN circuit should look as a reference. Here:

https://www.olimex.com/Products/ARM/ST/STM32-P207/resources/STM32-P207-P407_rev_D.pdf

We have used PB8 and PB9 but it should be similar for the rest of the pins that we mentioned.
Title: Re: Default CAN-bus Pin-outs but not accessible on Olimex STM32-E407 board
Post by: lim on October 21, 2020, 03:44:52 pm
From my experiments, I can confirm that PD0 and PD1 cannot be configured as CAN1. With the same code that passed all the CAN1 configuration at PB8 and PB9, it failed at the very beginning at the of code "if (HAL_CAN_Init(&hcan1) != HAL_OK)" generated by STM32CubeMX. I am so confused, and have no idea why?

Yet, with the code running transmitting at PB9, I am still not getting any CAN_TX signals. These are being shared by PB8/I2C1_SCL and PB9/I2C1_SDA. Looking at the I2C1_SDA and I2C1_SCL schematic, they look normal.

Any input is very appreciated.

Thank you



Title: Re: Default CAN-bus Pin-outs but not accessible on Olimex STM32-E407 board
Post by: lim on October 22, 2020, 03:05:31 am
Just to respond to the request of making sure the level is correct, I had not actually connected to anything, but simply measured from Oscilloscope if it has the CAN_TX signals. I am suspecting remapping of STM32CubeMX does not work properly.

Any comments are appreciated.
Title: Re: Default CAN-bus Pin-outs but not accessible on Olimex STM32-E407 board
Post by: lim on October 22, 2020, 08:31:41 am
I found the problem. The bit rate setting was totally out, I thought I had it set in STM32CubeMX. Somehow, I had cleared them, left with default which did not work.

Thank you