Page 1 of 1

STM32 as I2C slave is supported?

Posted: Thu Apr 09, 2020 9:33 pm
by fotios
Hi
I have a Particle Argon connected to an STM32F303 via I2C bus.
The Argon is configured for the instance as the master, with Baud = 100KHz.
The STM32F303 is configured as the slave as follows:
Channel = Software
Baud Select = 100KHz
Slew Rate Control = Disabled
SMBUS Inputs = Disabled
SDA = Port F.0
SCL = Port F.1
Address = 0x03
Mask = 0xFF
In the FCF I have included an I2C macro, taken precisely from the Matrix examples, that just receives the incoming byte and checks the Status (0x21) if is data or address, reads the address and sends ACK (0) and then reads the data and sends NACK (1).
The FCF is compiled successfully without errors.
In the Argon, I have flashed a test I2C code provided by Particle, which simply scans from address 0x00 to 0x7F if there is a slave connected to the bus and if yes it prints on the serial monitor its address.
I've tried many times with different configurations of STM32 but the Argon I2C scanner does not detect it. It returns always "I2C device not detected".

Please could you confirm if the I2C slave mode for STARM is working from the Flowcode side?
If yes, I could investigate the Particle Argon I2C side if there are bugs within the I2C scan firmware.

Thanks for any help.

Edit: From the hardware side, I've checked with the scope the SDA and the SCL lines and there is activity on both.

Re: STM32 as I2C slave is supported?

Posted: Sun Apr 12, 2020 9:42 am
by fotios
Hi there
Waste of time
Only master is workable.
I looked into the CAL_STARM_I2C folder. Here the result:

Code: Select all

//Slave functions currently not implemented
CALFUNCTION(void, FC_CAL_I2C_Slave_Init_, (MX_UINT8 Address, MX_UINT8 Mask))
{

}

CALFUNCTION(void, FC_CAL_I2C_Slave_Uninit_, (void))
{

}

CALFUNCTION(MX_UINT8, FC_CAL_I2C_Slave_TxByte_, (MX_UINT8 Data))
{
	return (0);
}

CALFUNCTION(MX_UINT8, FC_CAL_I2C_Slave_RxByte_, (MX_UINT8 Last))
{
	return (0);
}

CALFUNCTION(MX_UINT8, FC_CAL_I2C_Slave_Status_, (void))
{
	return (0);
}

Re: STM32 as I2C slave is supported?

Posted: Tue Apr 14, 2020 12:21 pm
by Benj
Hello Fotis,

I think it's on the list but no not currently. I'll see if it's something we can investigate sooner for you.

Re: STM32 as I2C slave is supported?

Posted: Thu Apr 16, 2020 8:45 am
by fotios
Hi Ben
Thanks a lot
I know the case. There are so many peripherals with a lot of potential configurations included in these micros. From a point of view, it is chaos and I understand very well your efforts in helping us.
In any case and having in mind that the master functionality is implemented, I currently try to configure the Particle Argon as a slave. It is a real nightmare as the only way is the use of Visual Studio Code included in Particle Workbench desktop IDE. There are of course ready I2C libraries offered in Git but the problem is that you have to make everything manually as all offered tools are freely shared. Additionally, the executable file is compatible with the Wire language (.ino) and the syntax of many commands, definitions, etc are quite different from the C++ standard of which I have some knowledge.
Thanks again.