This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Issue restarting a transaction in a serialized application

Hi,

I am currently porting the serialization transport layer to a stm32 chip (the spi 5W master configuration).

I am facing an issue in the state machine used to handle a single transaction :

When 0xFF is read on MISO after the first byte is send, the transfert abort and doesn't restart.

Explanation :

When receiving the first byte in spi_master_send_recv_irq(), the state machine handle is called with the event SPI_MASTER_EVT_FIRST_BYTE_RECEIVED and the received byte as data (here, not 0x00). The state machine will then go in the state HOOK_STATE_ABORTED and set the flag abort to true, but the state machine handle is never called again and the tranfert is blocked here.

I have solved this issue by replacing the else if (p_spi_instance->abort_flag){ ... by if (p_spi_instance->abort_flag){ ... in the function spi_master_send_recv_irq(), so when the state machine returns (after signaling the first byte received) it is called again just after to go to the state HOOK_STATE_RESTARTED and restart the transaction

The serialization works flawlessly with this "little" modification.

As the comment says near the condition I have modified, this part is "tricky" and it seems that I am missing something. Could someone explain to me how this part should work ?

Regards,

Romain

Parents Reply Children
No Data
Related