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
  • Thanks for your answer. I have received the 0x00 which tells me that the slave is not ready to exchange and this information is then transmitted to the state machine which set the abort flag to true. My problem is that spi_master_send_recv_irq need to be re-entered in order to initiate the restart procedure (going into that else if (p_spi_instance->abort_flag) condition). I don't see how this function can be re-entered as tranfert is now stop

Reply
  • Thanks for your answer. I have received the 0x00 which tells me that the slave is not ready to exchange and this information is then transmitted to the state machine which set the abort flag to true. My problem is that spi_master_send_recv_irq need to be re-entered in order to initiate the restart procedure (going into that else if (p_spi_instance->abort_flag) condition). I don't see how this function can be re-entered as tranfert is now stop

Children
No Data
Related