Problems with checkBus statements under ST_Nucleo use

Hey , guys.
I’m recently developing simplefoc using stm32neulco.

but when using any routine, this line pops up.

error: ‘SCL’ was not declared in this scope
int checkBus(byte sda_pin = SDA, byte scl_pin = SCL);

Before that, I have configured the stm32 on the arduino IDE.
The pins in the routine were modified according to the corresponding pins.
Then in order to find out which statement called the function, when I commented out the header file it showed normal, but at this point almost nothing could be done.

That is, only the
void setup() {}
void loop() {}
functions will compile, but keeping the headers will not.

For this reason, I got the arduino to test it, but the original function worked fine.

So how do I go about modifying these programs?

Thank you very much! :thinking:

This is the code I kept as follows, and he still has problems compiling with errors.

Hi @Javis_Yu,

Welcome to the forum :slight_smile:

So even an empty sketch with only #include <SimpleFOC.h> will result in a compile error?

To be sure that it is not library (SimpleFOC) related (and that the STM is working): Does compiling and uploading work with an empty sketch on the STM? Or does it work with other libraries or functions that use I2C?

1 Like

This function is an optional function. It is used to clear an I2C bus which can get stuck on stm32 devices. It is safe to delete the function (and its header declaration) if you don’t use it.

So why is SDA undefined? My suspicion is that you are using a maple core and not the stm32duino core. Is this the case?

I think it is probably true that we don’t test on maple cores only arduino cores

It is possible that your core is an stm32duino core but SDA is not defined somehow. What is the exact board you are using - there are loads of nucleo boards:

You could use a platform.local.txt to define
build.extra_flags=-DSDA=1 -DSCL=2


Thank you for your reply.
The board I am using is STM32F103RB Nucleo.
When I tried to remove this function, after removing the reference to the C file along with it. He was able to compile successfully, but it seems that the board does not seem to respond to anything.

Regarding what core he is then, I tried to burn the bilnk program directly into this board and he is also available for blink experiments. I think it still belongs to the stm32duino core.

Thank you for your reply. :smiley:

When I tried to compile and upload the basic Arduino example program, it was working, but when I just compiled it using


I got an error.

I’m not running any I2C behaviour and when I remove the phrase and delete the c file it still compiles and uploads fine, but nothing seems to happen.

I think that the SDA/SCL not defined is a fairly common thing - Raspi Pico doesn’t have them either, and I remember running into it before with other boards.

Perhaps we should add a #ifndef to define them ourselves if not defined?

1 Like

I’m happy for the arg defaults to be removed from header e.g
int checkBus(byte sda_pin = SDA, byte scl_pin = SCL);
int checkBus(byte sda_pin, byte scl_pin);

We’ll need a bit more information than that :wink:

1 Like