Porting Arduino´s library to Stm32

Post here first, or if you can't find a relevant section!
Post Reply
MrSentio
Posts: 1
Joined: Sat Nov 27, 2021 5:09 pm

Porting Arduino´s library to Stm32

Post by MrSentio »

Inspection of threads in iHi evryone,
I am a student and new to this forum. I have never worked with Stm32, I come from Arduino.
I started my project in Arduino, it is to connect the BNO080 without the reset pin and switches to the Stm32. I have a library of https://github.com/hcrest/sh2-demo nucleo/tree/master/EWARM. This one doesn't work without the reset pin and interrupt. That's why I tried to do it with the arduino and its Sparkfun library which works like a charm. But question is how I can on an IDE of STM32 IAR workbrenck import this library directly and not have to work with the one of CEVA which uses these two pins undesirable by my project.

Thank´s you very much for support.
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: Porting Arduino´s library to Stm32

Post by mrburnette »

https://github.com/hcrest/sh2-demo-nucleo
Note: This repository is similar to another one, bno080-nucleo-demo. That earlier repository used FreeRTOS and only supported the BNO080 processor. This one does not rely on any RTOS, features an improved library API and simpler HAL interface, and also supports the FSP200 module.

As I understand, you started the project with an Arduino board and now wish to morph the old lib into an STM32 compatible lib?
I tried to do it with the arduino and its Sparkfun library which works like a charm.
Sparkfun Library


Looking at the code, Sparkfun is specifying (partial as exampls):

Code: Select all

	uint8_t getTapDetector();
	uint32_t getTimeStamp();
	uint16_t getStepCount();
	uint8_t getStabilityClassifier();
	uint8_t getActivityClassifier();

	int16_t getRawAccelX();
	int16_t getRawAccelY();
	int16_t getRawAccelZ();

	int16_t getRawGyroX();
	int16_t getRawGyroY();
	int16_t getRawGyroZ();

	int16_t getRawMagX();
	int16_t getRawMagY();
	int16_t getRawMagZ();
In STM32 land, an Integer is int32_t while in 8-bit AVR land the integer is int16_t. You will need to carefully recode integers while not screwing up legitimate int16_t variables. This can be errorprone and tedious. Be particularly cautious of all structure sizes that they use sizeof and are not hardcoded.

You may find it easier to search for a library that meets your requirements or utilize the additional signals.
CharlesBottoms
Posts: 3
Joined: Mon Apr 11, 2022 8:46 pm

Re: Porting Arduino´s library to Stm32

Post by CharlesBottoms »

Thanks it helped a lot. As a student I also understand you very much, but I had more of a problem with literature. Eventually, I came across a service https://freebooksummary.com/category/an ... the-peoplewith free student book summaries an enemy of the people for example. So much less time is spent studying the book.
Post Reply

Return to “General discussion”