cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G030K8T6 i2c slave: get received address before NACK?

mfcheckup
Associate

Hi,

I want my slave device to be able to sniff packets destined for other slaves on the same bus. At the moment, communication management is based on HAL with interrupts, and I can see when the master sends requests to me because I enter the address match interrupt.

I would like to take a step back and see where a wrong address is discarded, before answering with a NACK.

I want my slave to be able to understand when the packets are intended for another slave with a specific address and from there monitor the communication to sniff the information.

Is that possible?

I can't find where an address that doesn't match mine is discarded.

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Super User

This is not possible in the I2C peripheral. You can answer on 1 or 2 slave addresses (plus general call), but not all. You don't get notified when an address doesn't match.

You could do it in software independent from the I2C peripheral but it would take quite a bit of expertise.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
Andrew Neil
Super User

You would need a deep-dive into the I2C section of the Reference Manual for the chip to understand how the I2C peripheral works:

via: https://www.st.com/en/microcontrollers-microprocessors/stm32g030k8.html#documentation

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
TDK
Super User

This is not possible in the I2C peripheral. You can answer on 1 or 2 slave addresses (plus general call), but not all. You don't get notified when an address doesn't match.

You could do it in software independent from the I2C peripheral but it would take quite a bit of expertise.

If you feel a post has answered your question, please click "Accept as Solution".
Saket_Om
ST Employee

Hello @mfcheckup 

The STM32 I²C peripheral only triggers the ADDR interrupt if the address matches. There is no HAL callback or interrupt for non-matching addresses.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om