-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
boards: add support for bluepill board #7727
Conversation
Is there a difference between this board and the already existing maple mini board? As far as I can see, they look (to the eye) identical and they have the same cpu. |
It is as similar to the maple-mini as it is to the nucleo-f130. The definitions in It would probably be a good idea to add an |
I was afraid that there would be some duplicate work, but good that it is not the case here. |
Hi, I tested with my bluepill board, which has a With #7735 it works as expected ... |
The three UART port are in a different order in this PR then in #7735, which means the pins of the UART used for stdout are different. This might explain your issue. The hardware we used for testing also uses a STM32F103C8T6, the CPU definition uses a STM32F103CBT6 because we are pretty sure that they have 128 KiB Flash anyway, as mentioned here. Since this is not yet 100% conclusive, it would be awesome If people with this hardware could test this. |
@kurth1 thanks for the infos! Regarding the UART: yes saw that, too - still I think its better to use UART2 (as in #7735) for RIOTs term/shell connection because UART1 lies on the same pins as I2C1, see here. Regarding the flash size, I don't know wouldn't it be safer to use the lower variant as default until further verification. I guess with those cheap boards it may depend on the production line which it will be, and could lead to some nasty to debug errors, if one has a device with only 64KB flash. |
I don't really know why |
@pyropeter you're right, but that's true for many boards. Still it would be good to have a sensible default, which also allows other periphs to run by default as well. That's why I would recommend to set UART2 as the default for RIOTs primary shell-UART. UART1 and 3 collide with I2C, though I know UART2 collides with some ADC pins, but there are 8 of them so we can manage to loose 2 of them for UART, right? |
I suggest you keep the ordering of the UART modules to match the chip order, and instead define UART_STDIO_DEV in board.h. See boards/mulle/include/board.h for an example. |
49f1507
to
ae8545b
Compare
a2f5a97
to
50bd71c
Compare
We also copied and tested the saul gpio configuration and changes made to the Makefiles in |
50bd71c
to
05ab6ca
Compare
Before merge I'd like to verify that SPI is working with the given configuration, I'll try to test within the next days. Further, I've some concerns regarding the board name, it might be worth considering to rename it into |
I don't have a strong opinion on this, the board name is just a string after all. However, the other boards in |
I'm against rename the board to something with stm32, to me that would make it appear as if there are multiple versions of the bluepill board. Would a symlink from |
We used to have some symlinks in the repo before, but it causes issues for users on windows and using some file systems so we replaced them. I suggest just adding some more information in the board's doxygen page regarding names and what else might be relevant. |
@gebart I agree with adding information to the doxygen. I can imagine symlinks causing weird issues on different platforms :( |
We are intending to also write a wiki page about this board. Wouldn't it be better to place this information in the wiki? |
@nmeum sorry for the confusion. This information is perfect for the wiki, but it is also good to have some kind of references for alternate names directly in the source tree as well (Doxygen). You may put the information wherever you think is best (or both), as long as there is some text describing that this board has several different names across the web, to make it more likely to find the correct page when someone is searching for this board. There's an ongoing discussion regarding where to put information about the supported platforms (wiki vs. Doxygen). I favor Doxygen because that is where I tend to look first and I think it is easier to keep up to date when things are added or modified, but others favor the wiki because it may be more familiar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verified by testing, basic board supports works.
fixes #6967 |
05ab6ca
to
7e391c4
Compare
We just added a few comments regarding the flash size to the doxygen documentation as suggest by @gebart. Is there anything else we can do to get this merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nits
boards/bluepill/include/board.h
Outdated
#endif | ||
|
||
/** | ||
* @brief LED pin definitions and handlers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use @name
for doxygen grouping, as done below for xtimer config
boards/bluepill/include/board.h
Outdated
* @defgroup boards_bluepill Bluepill board | ||
* @ingroup boards | ||
* @brief Support for the stm32f103c8 based bluepill board. | ||
* @details This board can be bought very cheaply on sides like eBay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add empty line and omit @details
- IMHO its not needed when separated from @brief
by an empty line
you may squash fixes directly. |
7e391c4
to
9b3714b
Compare
@smlng Done! |
I'm happy and will test later at home, where I have the board ready for testing. If nobody objects until then I tend to merge this. Any further additions etc. can be done in followup PRs. |
Nice work btw.!!! |
ACK & GO! |
We just published a wiki page for this board: https://github.com/RIOT-OS/RIOT/wiki/Board:-Bluepill we are intending to improve this because we still don't know how to force OpenOCD to use 128 KB instead of 64 KB flash on this board. In case somebody knows how to do that let us know … |
Is OpenOCD throwing an error when you try to flash it? Or it's at linking? If linking is the problem #7799 can solve it. However, OpenOCD just gets the size of the ROM by reading it from the chip (through the model), thus even if the mcu has actually more ROM OpenOCD cannot "override" the configuration for the given model. |
OpenOCD doesn't throw an error at all. It allows me to flash the binary but the program doesn't work accordingly afterwards.
I only looked at this very briefly but there seems to be an OpenOCD |
Taking more closely a look, this seems to be a "printing" error, since "8" and "B" look quite similar. Thus, can we assume that bluepill has a stm32f103cb in all cases? |
no we cannot (and shouldn't). We lately bought 60 blueppills and for only 3 (that is 5%) openocd reported 128KB flash size the rest was 64KB. Though they might have 128KB too in theory, I wouldn't recommend to count on that in all cases. |
Do those three chips have a
@nmeum, after looking at the code, I'm sure this will work. I'm still not sure if the extra flash should be used, though. |
@pyropeter for me all 60 bluebills we bought are marked as |
i.e., also those with 128KB are labeled |
This pull request adds support for the stm32 based bluepill board. This board is widely available at a very low cost on sites like AliExpress and others.
Initial work was done by @obgm but his RIOT fork was outdated and incomplete thus we started from scratch based on the nucleon-f103 board. However, we noticed that some peripheral configuration options were missing in the nucleon-f103
periph_conf.h
header file. For instance, the general purpose timer four wasn't configured and thecs_pin
for the SPI devices wasn't set. In addition to that PWM and ADC support was missing on the nucleon-f103. Compared to the nucleon-f103 we didn't configure i2c in theperiph_conf.h
file for the bluepill board because we couldn't test it yet, but it is very likely that the i2c configuration from the nucleon-f103 can simply be copied for this board.All other peripherals were tested using the tests available in
tests/
. We are also planning to expand support for this board in the future. Apart from i2c we would also like to add support for CAN available on the device.This was a group effort involving Alexander Kurth, Tristan Bruns, Christian Manal and myself.