-
Hello there, I am working on a project using the STM32F427II where I am attempting to poll two AS5600 encoders via a TCA9548 multiplexer. I've encountered an issue where the result of the runTransaction alternates between true and false fairly consistently; essentially, every other I2C call seems to fail. Additionally, when increasing the read request rate, a significant portion of the requests fail intermittently. For instance, at a polling rate of 500Hz, there are alternating periods of approximately 100ms where no new data is read from the sensors. To troubleshoot, I initially suspected that interrupts from UART might be causing the issue. However, after testing with only the encoders wired up, I observed similar behavior. My current workaround is to poll at 250Hz with two reads per iteration, assuming one call will fail. This is my first time developing for this system and I am seeking further guidance. Is there a known issue with transactions failing when polling too fast, or is there something I might have misconfigured in my code? Link to the repository. Relevant files are main.cpp and encoder class |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You're using resumable functions wrong by not polling the runTransaction for completion. You need to wrap all calls to readRegister/writeRegister with For consistency you should also use |
Beta Was this translation helpful? Give feedback.
You're using resumable functions wrong by not polling the runTransaction for completion.
You need to wrap all calls to readRegister/writeRegister with
RF_CALL_BLOCKING()
to keep polling the transaction until it's finished.You're currently kinda getting around it by using
momd::delay_ms(100);
after each write, but that doesn't actually check if the transaction finished.For consistency you should also use
RF_WAIT_WHILE()
instead of thewhile
loop in read-/writeRegister.