i2c issues
Posted: Sun Dec 04, 2022 9:45 am
Hi
I am writing a I2C component to handle communication with a DSP. There are some problems i need to discuss because I am not sure if I handling the I2C protocol correctly.
First, ESP is master and DSP is slave.
I have defined a protocol where ESP is sending a command and DSP is returning a response. The response is data values.
The ESP knows what command it have sent and knows how much data it is expecting back from the DSP.
The first byte of data is a "status" byte that can be interpreted by the ESP.
The ESP is requesting correct number of data bytes from the DSP based on command.
This part of the "protocol" is working fine.
The problematic part is.
To avoid the requirement that the firmware in ESP and DSP must be completely in sync in respect versioning there is a special case.
- If the DSP don't recognize the received command it returns "unknown command" in the status byte. Also it returns M bytes.
Because of the ESP is expecting N bytes of data and the DSP responding witch M bytes of data the ESP throws a WDT interrupt.
I have set all ESP watchdogs to seconds to make sure that none of them are the cause of the interrupt so the conclusion is that somewhere in the ESP-IDF i2c component there is a timer watchdog that are triggered.
Normally when ESP and DSP agrees on the number of bytes that should be returned from the DSP, this is not happening.
So my questions is.
- is it even possible to use i2c in the way I intend?
- is it possible to add my own code to catch this error ?
I am writing a I2C component to handle communication with a DSP. There are some problems i need to discuss because I am not sure if I handling the I2C protocol correctly.
First, ESP is master and DSP is slave.
I have defined a protocol where ESP is sending a command and DSP is returning a response. The response is data values.
The ESP knows what command it have sent and knows how much data it is expecting back from the DSP.
The first byte of data is a "status" byte that can be interpreted by the ESP.
The ESP is requesting correct number of data bytes from the DSP based on command.
This part of the "protocol" is working fine.
The problematic part is.
To avoid the requirement that the firmware in ESP and DSP must be completely in sync in respect versioning there is a special case.
- If the DSP don't recognize the received command it returns "unknown command" in the status byte. Also it returns M bytes.
Because of the ESP is expecting N bytes of data and the DSP responding witch M bytes of data the ESP throws a WDT interrupt.
I have set all ESP watchdogs to seconds to make sure that none of them are the cause of the interrupt so the conclusion is that somewhere in the ESP-IDF i2c component there is a timer watchdog that are triggered.
Normally when ESP and DSP agrees on the number of bytes that should be returned from the DSP, this is not happening.
So my questions is.
- is it even possible to use i2c in the way I intend?
- is it possible to add my own code to catch this error ?