Skip to content

Add support for STM32 MCU based boards #378

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 1 commit into from
Aug 6, 2017
Merged

Add support for STM32 MCU based boards #378

merged 1 commit into from
Aug 6, 2017

Conversation

fpistm
Copy link
Contributor

@fpistm fpistm commented Aug 1, 2017

Hi,

This PR add the support of STM32 MCU based board.
More information here: STM32 cores enabled in Arduino IDE
Latest release of the Arduino_Core_STM32 is functional with Firmata. The modified lib with ARDUINO_ARCH_STM32 is currently released with the core and could be removed when this PR will be merged.
Core is provided as a package thanks the Arduino Boards manager, see the wiki

Thanks in advance

Boards.h Outdated
#define IS_PIN_I2C(p) (IS_PIN_DIGITAL(p) && digitalPinHasI2C(p))
#define IS_PIN_SPI(p) (IS_PIN_DIGITAL(p) && digitalPinHasSPI(p))
#define IS_PIN_INTERRUPT(p) (IS_PIN_DIGITAL(p) && (digitalPinToInterrupt(p) > NOT_AN_INTERRUPT)))
#define IS_PIN_SERIAL(p) (digitalPinHasSerial(p))
Copy link
Member

@soundanalogous soundanalogous Aug 4, 2017

Choose a reason for hiding this comment

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

If any UART pins share the main USB/UART programming connection, please exclude those pins here (whatever maps to Serial instead of Serial1, Serial2, etc).

Copy link
Contributor Author

@fpistm fpistm Aug 4, 2017

Choose a reason for hiding this comment

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

You mean something like that?
#define IS_PIN_SERIAL(p) (digitalPinHasSerial(p) && !pinIsSerial(p) )
because pin could support Serial and not used by the programming connection?
But you're right in this case, IS_PIN_SERIAL is true for the Serial used to communicate with firmata fw. So adding !pinIsSerial(p) seems required

Copy link
Member

Choose a reason for hiding this comment

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

Yes that is correct as defined here.

Also is seems strange that there are Firmata-specific macros defined in Arduino_Core_STM32. It's convenient for sure, but ideally board cores shouldn't need to know anything specific about Firmata. What is really missing is a well defined HAL that exposes board capabilities across the entire Arduino ecosystem. This is one area that Arduino only loosely defined so you see a lot of variance in macros defined across all of the various boards defined for the Arduino ecosystem. If such a system were in place and properly maintained, there would be no need for the Firmata Boards.h file. Some day perhaps (wishful thinking).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed with you.
In fact the core know anything about Firmata. It only give a macro that Firmata could use for STM32 arch and define the PIN_SERIAL_RX && PIN_SERIAL_TX which are different for each STM32 based board.

Note about this line: Due to the pin mapping implementation and allow the most possibilities for each pins/boards some pins are duplicated to handle Analog input.
So this one is used to ensure to not break the Serial link btw Firmata client and Firmware.

About a well defined HAL that exposes board capabilities... Sounds great but seems hard to align all the Arduino ecosystem.
That's why I tried to use proper macro definition/name to avoid any further change request in Firmata/arduino.

@soundanalogous
Copy link
Member

Can you squash these 2 commits? Then this will be ready to merge.

Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
@fpistm
Copy link
Contributor Author

fpistm commented Aug 6, 2017

Done. Thanks in advance.

@soundanalogous soundanalogous merged commit fd6d2f6 into firmata:master Aug 6, 2017
@fpistm fpistm deleted the arduino_core_stm32 branch August 7, 2017 07:21
@fpistm
Copy link
Contributor Author

fpistm commented Aug 11, 2017

Hi Jeff,
Just for my information, when the next release is planned ?
Thanks in advance.
Fred

@soundanalogous
Copy link
Member

There are a couple of changes I want to make to StandardFirmataEthernet before I push the next release. Sometime this weekend would be the earliest, but it could end up being another week or two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants