5 years, 9 months ago.

STM32f105 + MBED + can = not work.

Hello.

Started learning MBED OS. First I worked with Stm32f103. It turned out to work with the tire. But the device requires 2 can and usb, so this processor is not suitable. For the device selected stm32f105 processor.

I started creating projects, but there are no boards with this processor in the list of supported ones. After that, I filled in the program compiled under f103 processor in f105. The LED that flashes once a second worked, but there is no can bus connection to the device.

As far as I understood the problem in the configuration of the driver itself.

shematics /media/uploads/fokin91/2019-02-21_18-17-58.png

code

/media/uploads/fokin91/2019-02-21_18-17-19.png

Is it possible to make the whole thing work together?

P.S.

CAN began to work on the outputs of PB8 and PB9, since on the same conclusions there is a channel in the f103 microcontroller. On the findings of PB5 and PB6, CAN does not want to run.

1 Answer

5 years, 9 months ago.

It's difficult to answer since this micro is not directly supported. If CAN was not supported on those pins in original micro, then you will need to go through the source code and enable CAN on those pins. First thing that comes to mind is PeripheralPins.c.

https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/PeripheralPins.c

You will need to add entries there for your PB5 and PB6 pins.

Also the code for 103 knows nothing about the second CAN module. You will need to track down locations where this info is needed and add in the second module. PeripheralPins.h comes to mind.

https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/PeripheralNames.h

Which then leads you to stm32f103xb.h where you'll need to define CAN2_BASE address.

https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/device/stm32f103xb.h

You're going to have to chase all these down to get CAN2 to work. Obviously need to check CAN driver itself and then need to make sure it's getting the right clock signal.

Also are you watching serial out for messages from mbed? If you fail to initialize a peripheral you will usually get a warning message to help pinpoint where it's failing.

I quit this venture after 2 days spent .. I already did everything you listed. In addition, I have already replaced the stm32а103 file with a stm32f105 file taken from stm32cube mx. After that errors fell down, as there are more timers in the F105 file and they caused problems. Picked them up, but the kan did not start after that. Therefore, I began to deal with stm32kube and keil.

posted by Alexey Fokin 24 Feb 2019