Arduino Libraries incorrectly working on STM32F401RE

Post here first, or if you can't find a relevant section!
Post Reply
Posts: 1
Joined: Fri May 22, 2020 3:52 pm

Arduino Libraries incorrectly working on STM32F401RE

Post by AzizulHaque »


I am doing a project with the ADS1292R ECG breakout board ( . The script connects to the ADS1292R shield, reads the data then sends data over serial for the PC to analyse. Works fine, I get a nice waveform on the PC. I installed the STM32 boards to the Arduino IDE, GPIO on and off works fine no issues. but when I load the same code to the STM32F401RE it compiles. but the waveform is incorrect. looks like corrupted data.

Any idea why?

Posts: 311
Joined: Thu Dec 19, 2019 1:23 am
Answers: 1

Re: Arduino Libraries incorrectly working on STM32F401RE

Post by mrburnette »

Need more info from you:
- What version of the STM32duino core are you using?
- What OS are you using, Windows 32-bit, Windows 64-bit, iOS, Linux 32/64-bit?
- What warnings are you getting (you have warnings enabled)?
- Which Ardhino board did you test to get a successful trial?
- Assuming you are stacking the Shield onto the F401RE as stated:
Connect the ECG/Respiration shield to the Arduino by stacking it on top of your Arduino. This shield uses the SPI interface to communicate with the Arduino. Since this includes the ICSP header, which is used on newer Arduinos for SPI communication, this shield is also compatible newer Arduino boards such as the Arduino Yun and Due.
Could be something in the library presumption that the shield will be used on an 8-bit Arduino instead of a 32-bit Arduino; that is, int could be cast wrong: 16-bit verses 32-bit. More often than not, library authors make incorrect assumptions on the hardware or do not update the library to include newer hardware: then default to values that are incorrect.

Library authors of AVR and ARM common codebase often do as this Adafruit Example:

Code: Select all

#ifdef __arm__
// should use uinstd.h to define sbrk but Due causes a conflict
extern "C" char* sbrk(int incr);
#else  // __ARM__
extern char *__brkval;
#endif  // __arm__
int freeMemory() {
  char top;
#ifdef __arm__
  return &top - reinterpret_cast<char*>(sbrk(0));
#elif defined(CORE_TEENSY) || (ARDUINO > 103 && ARDUINO != 151)
  return &top - __brkval;
#else  // __arm__
  return __brkval ? &top - __brkval : &top - __malloc_heap_start;
#endif  // __arm__
Such tests are not made in the library you're using (just did a very quick review, may have missed something.)

Board looks fully supported fully on status page

Code: Select all

Status	Device(s)	Name	Release	Notes
green	STM32F401RE	Nucleo F401RE	0.2.1	


Post Reply

Return to “General discussion”