Skip to content

Adding STORM32_V1_31_RC variant #1375

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

Merged
merged 20 commits into from
May 3, 2021
Merged

Conversation

owennewo
Copy link
Contributor

Summary

Adding STORM32_V1_31_RC variantI

I've placed this in the ESC_board menu - technically it is a 3axis gimbal controller (not an ESC) but it can be used as an ESC for smaller motors.

This is a very popular board designed by Olliw (I have no affiliation).
http://www.olliw.eu/storm32bgc-wiki/Main_Page

Validation
I've tested this using SimpleFOC library and have most things working

  • SerialUSB, Serial3, I2C1, I2C2
  • Can spin 3 motors

Here is an example sketch of it in use:
https://gist.github.com/owennewo/68c3de58d3e14b702552f0c149de41b0

@fpistm fpistm added the new variant Add support of new bard label Apr 29, 2021
@fpistm fpistm added this to the 2.x.x milestone Apr 29, 2021
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @owennewo
Thanks for your contribution.
Nice first PR moreover you are the first contributor with the new format.
Hope it was not so hard, wiki will be updated soon.

In addition to my comments could you also update the README.md to reference it in the ESC section.
Moreover it is not very clear for me which board STorM32 board you add?
Is it this one ? http://www.olliw.eu/storm32bgc-wiki/STorM32_Boards#STorM32-BGC_v1.3
In that case why RC instead of BGC ?

Tthank you in advance.

@owennewo
Copy link
Contributor Author

I've repushed with a README.

Yes that link is correct. RC refers to STM32F103RC which is by far the most common flash size version (and is the one I have), but as this board is open source, people have made RB, RE and RG versions which I've not tested and don't really know whether they'll work. If you'd prefer me to remove the RC from the name, so that others can later add support for different flash sizes then I can do that. I can also add BGC (which I think stands for Brushless Gimbal Controller) if you like.

@fpistm
Copy link
Member

fpistm commented Apr 30, 2021

Thanks for the README.
About the different flash size, in fact it can be managed easily by adding correct boards entry in the boards.txt and renaming the variant_STORM32_V1_31_RC.* and peripheralPins_STORM32_V1_31_RC.c to
variant_STORM32_V1_31_Rx.* and peripheralPins_STORM32_V1_31_Rx.c

Then adding in the boards.txt:

# STORM32_V1_RC board
ESC_board.menu.pnum.STORM32_V1_31_RC=STorM32 BGC v1.31 RC
ESC_board.menu.pnum.STORM32_V1_31_RC.upload.maximum_size=262144
ESC_board.menu.pnum.STORM32_V1_31_RC.upload.maximum_data_size=49152
ESC_board.menu.pnum.STORM32_V1_31_RC.build.mcu=cortex-m3
ESC_board.menu.pnum.STORM32_V1_31_RC.build.board=STORM32_V1_31_RC
ESC_board.menu.pnum.STORM32_V1_31_RC.build.series=STM32F1xx
ESC_board.menu.pnum.STORM32_V1_31_RC.build.product_line=STM32F103xE
ESC_board.menu.pnum.STORM32_V1_31_RC.build.peripheral_pins=-DCUSTOM_PERIPHERAL_PINS
ESC_board.menu.pnum.STORM32_V1_31_RC.build.cmsis_lib_gcc=arm_cortexM3l_math
ESC_board.menu.pnum.STORM32_V1_31_RC.build.variant=STM32F1xx/F103R(C-D-E)T
ESC_board.menu.pnum.STORM32_V1_31_RC.build.variant_h=variant_STORM32_V1_31_Rx.h

# STORM32_V1_RD board
ESC_board.menu.pnum.STORM32_V1_31_RD=STorM32 BGC v1.31 RD
ESC_board.menu.pnum.STORM32_V1_31_RD.upload.maximum_size=393216
ESC_board.menu.pnum.STORM32_V1_31_RD.upload.maximum_data_size=65536
ESC_board.menu.pnum.STORM32_V1_31_RD.build.mcu=cortex-m3
ESC_board.menu.pnum.STORM32_V1_31_RD.build.board=STORM32_V1_31_RD
ESC_board.menu.pnum.STORM32_V1_31_RD.build.series=STM32F1xx
ESC_board.menu.pnum.STORM32_V1_31_RD.build.product_line=STM32F103xE
ESC_board.menu.pnum.STORM32_V1_31_RD.build.peripheral_pins=-DCUSTOM_PERIPHERAL_PINS
ESC_board.menu.pnum.STORM32_V1_31_RD.build.cmsis_lib_gcc=arm_cortexM3l_math
ESC_board.menu.pnum.STORM32_V1_31_RD.build.variant=STM32F1xx/F103R(C-D-E)T
ESC_board.menu.pnum.STORM32_V1_31_RD.build.variant_h=variant_STORM32_V1_31_Rx.h

# STORM32_V1_RE board
ESC_board.menu.pnum.STORM32_V1_31_RE=STorM32 BGC v1.31 RE
ESC_board.menu.pnum.STORM32_V1_31_RE.upload.maximum_size=524288
ESC_board.menu.pnum.STORM32_V1_31_RE.upload.maximum_data_size=65536
ESC_board.menu.pnum.STORM32_V1_31_RE.build.mcu=cortex-m3
ESC_board.menu.pnum.STORM32_V1_31_RE.build.board=STORM32_V1_31_RE
ESC_board.menu.pnum.STORM32_V1_31_RE.build.series=STM32F1xx
ESC_board.menu.pnum.STORM32_V1_31_RE.build.product_line=STM32F103xE
ESC_board.menu.pnum.STORM32_V1_31_RE.build.peripheral_pins=-DCUSTOM_PERIPHERAL_PINS
ESC_board.menu.pnum.STORM32_V1_31_RE.build.cmsis_lib_gcc=arm_cortexM3l_math
ESC_board.menu.pnum.STORM32_V1_31_RE.build.variant=STM32F1xx/F103R(C-D-E)T
ESC_board.menu.pnum.STORM32_V1_31_RE.build.variant_h=variant_STORM32_V1_31_Rx.h

And in each files adding the correct switch:
#if defined(ARDUINO_STORM32_V1_31_RC) || defined(ARDUINO_STORM32_V1_31_RD) || defined(ARDUINO_STORM32_V1_31_RE)

In fact the linker script is preprocessed so the correct flash and RAM size will be used:

/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE
FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
}

Note that you didn't fix my other review comments.

@owennewo
Copy link
Contributor Author

I'll retest after accepting your changes. The Serial3/SerialUSB took me a while to get working automatically so this is the area I'm not confident in - perhaps something else is missing in this area.

Regaring RC/RB/RE/RG versions of this board - I think I confused myself and you

RC - exists
RE - only exists in a later variant (3.x which is quite different)
RB and RG are mentioned in this schematic https://community.simplefoc.com/uploads/default/original/1X/6f1cdb4a8d6bfdd6d405aa340ca2571f5be42738.jpeg but I've not seen them for sale. I don't think they exist!
TLDR: I think we only need single flash size RC

@fpistm
Copy link
Member

fpistm commented May 3, 2021

OK so we can kept only one variant.

The Serial3/SerialUSB took me a while to get working automatically so this is the area I'm not confident in - perhaps something else is missing in this area.

I'm confident 😉

Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR LGTM. Only one question about the HAL_SD_MODULE_ENABLED .

@owennewo
Copy link
Contributor Author

owennewo commented May 3, 2021

OK so we can kept only one variant.

The Serial3/SerialUSB took me a while to get working automatically so this is the area I'm not confident in - perhaps something else is missing in this area.

I'm confident

I found the issue - ESC_board.menu was missing CDC (generic 'Serial' supersede U(S)ART) (I was using CDC (No generic Serial) )

Hopefully this is ready to merge

@fpistm
Copy link
Member

fpistm commented May 3, 2021

I found the issue - ESC_board.menu was missing CDC (generic 'Serial' supersede U(S)ART) (I was using CDC (No generic Serial) )

Nice catch I missed that. 🙄

Hopefully this is ready to merge

Yes, I've made a small update of USB menu entry.

@fpistm fpistm merged commit 66b01b0 into stm32duino:master May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new variant Add support of new bard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants