STM32h725 Slave PSSI bad length
Hello,
I'm trying to use the PSSI bus in slave mode to transmit data from a small FPGA. After some time chasing a weird bug (I'm losing 8 32bit words at the end of packet) I decided to use a logic analyzer on the bus and it showed a weird behavior from the stm32.
Code configuration:


The code is called in a loop with a flag reset in the transfer callback complete:
if (((USBD_CDC_HandleTypeDef*) hUsbDeviceHS.pClassData)->TxState == 0) {
if(PSSI_RCV_CPLT) {
PSSI_RCV_CPLT = 0;
if (!buf_sel) {
if(HAL_PSSI_Receive_DMA(&hpssi, (uint32_t*)tbuf , 512)!= HAL_OK) {
Error_Handler();
}
buf_sel = 1;
if(CDC_Transmit_HS(abuf, 2048) != USBD_OK) {
uint8_t badusbtiming = 1;
}
} else {
if(HAL_PSSI_Receive_DMA(&hpssi, (uint32_t*)abuf , 512)!= HAL_OK) {
Error_Handler();
}
buf_sel = 0;
if(CDC_Transmit_HS(tbuf, 2048) != USBD_OK) {
uint8_t badusbtiming = 1;
}
}
}
}
Reset of the PSSI complete flag.
void HAL_PSSI_RxCpltCallback(PSSI_HandleTypeDef *hpssi)
{
PSSI_RCV_CPLT = 1;
}
At the begins of the first valid buffer the USB data and the bus capture are aligned:


But at the end of the first buffer there is a loss of 8*sizeof(uint32_t) => 32 byte.


We can see on the capture that those missing byte are transferred through the bus and dropped and the begins of the next packet align.

While looking at the full packet length it appears why we have that results. The total valid time of PRDY signal is 83.28us, knowing the clock runs at 25MHz (period of 40ns) it means there are 2082 cycle of PRDY valid, removing the first cycle (where PDE is not asserted) and the last cycle discarded (I repeat this one later) it makes 2080 cycle. If we take an expected length of 2048 cycle and add the 32 missing byte it reaches 2080 cycle.
For now I can lock in FPGA the length to 2048 and hope for the PRDY to go low but it's not a good solution. Maybe I'm doing something wrong, do you have any idea of why this behavior and what I may be doing wrong ?
Thanks a lot,