Skip to main content
Explorer
November 27, 2025
Solved

STM32G030K8T6 i2c slave: get received address before NACK?

  • November 27, 2025
  • 3 replies
  • 155 views

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

Best answer by TDK

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.

3 replies

Andrew Neil
Super User
November 27, 2025

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
TDKBest answer
Super User
November 27, 2025

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""."
Technical Moderator
December 1, 2025

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"