Paolo
Hello,
I'm back with a new problem,
I can transfer the program to my STM32-F401CCU6 board using the board type Blackpill STM32-F411CE (DFU STM32 Bootloader) [2.8.1].
But the LED does not flash. It's connected to PC13, so %QX0.5 on OpenPLC, right? Where is my mistake?
Or do we have to redefine the board type to be able to use this model?
I've included images of my program and the menu on the Arduino IDE showing the settings that work with this board.
Thanks for the help
OpenPLC Editor - ~Blink~ 10_10_2024 22_39_50.png
sketch_oct10a _ Arduino IDE 2.3.3 10_10_2024 22_48_08.png
Reply 0 0
thiagoralves
You’re trying to program a F401CCU6 with a program compiled for the F411CE. They are not even the same family. Of course it is not going to work. OpenPLC is not compatible with your board. You’ll need to get a compatible board or write the HAL layer for your board
Reply 1 0
fg71
Copy any STM object in hals.json and rename it to your board name.
The fqbn you get from this command: arduino-cli board listall
 
fqbn is the column at right
 
[203128%2F9018843%2Fmceclip0]
 
From the Readme.md I find this for your board.
[203128%2F9018866%2Fmceclip0]
Reply 0 0
Paolo
You’re trying to program a F401CCU6 with a program compiled for the F411CE. They are not even the same family. Of course it is not going to work. OpenPLC is not compatible with your board. You’ll need to get a compatible board or write the HAL layer for your board
I thought you were going to say that... I think writing the HAL layer is way beyond my capabilities.
Reply 0 0
fg71
I think writing the HAL layer is way beyond my capabilities.
You edit: your_path_to_openPLC/editor/arduino/examples/Baremetal/hals.json
 
Its a json file you could edit that file with your favorite text editor and follow the structure of it.
If you know the fqbn for your board it will take less and 1 minute to do it. 😉
Reply 0 0
Paolo
You edit: your_path_to_openPLC/editor/arduino/examples/Baremetal/hals.json
 
Its a json file you could edit that file with your favorite text editor and follow the structure of it.
If you know the fqbn for your board it will take less and 1 minute to do it. 😉
Yes, I thought I could do that, but without your help I didn't quite understand. Now it's clearer, but what about this line?
"source": "stm32_f411ce.cpp",
Should I rewrite (or find it somewhere) this file or should I try with this one?
Reply 0 0
fg71
Should I rewrite (or find it somewhere) this file or should I try with this one?
I have before copy .cpp and rename it to the board I like to add. But I'm not sure if you need it anymore if I have understood thiagoralves
Reply 0 0
thiagoralves
This file is the C code specific for your board. You can try to just use the same file but there is a chance the IO mapping will be incorrect.
Reply 0 0
Paolo
Thanks to both of you, I actually managed to get the Blink program to work quite easily by modifying the hals.json file. I needed your expertise to have the nerve to add a board definition.
I'm now going to check that the IOs match up properly.
Thanks again
Reply 0 0
Reply