STM32 as I2C slave is supported?

An area to discuss ARM specific problems and examples

Moderator: Benj

Post Reply
User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

STM32 as I2C slave is supported?

Post 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.
Best Regards FOTIS ANAGNOSTOU

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: STM32 as I2C slave is supported?

Post 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);
}
Best Regards FOTIS ANAGNOSTOU

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: STM32 as I2C slave is supported?

Post 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.

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: STM32 as I2C slave is supported?

Post 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.
Best Regards FOTIS ANAGNOSTOU

Post Reply