2026-05-13 4:15 PM
I'm working with an STM32U3C5RIT6 using the HSP to do some FFT-based audio DSP with the HSP Engine middleware. I've got it working correctly using direct mode and I'm trying to squeeze out a bit more performance using process lists but for some reason the RFFT output isn't the same when used in a process list.
Here's the code I use for accelerator / direct mode which works correctly:
HSP_ACC_VectMul_f32(&hmw, FFT_Buffer, Window, FFT_Buffer, HSP_BLKSZ);
HSP_ACC_Rfft_f32(&hmw, FFT_Buffer, HSP_LOG2NBP_512, 0U, 1U, HSP_RFFT_TYPE_2);I then create a process list using the SEQ versions of the same operations:
HSP_SEQ_StartRecordPL(&hmw, PROC_IN);
HSP_SEQ_VectMul_f32(&hmw, FFT_Buffer, Window, FFT_Buffer, HSP_BLKSZ, HSP_SEQ_IOTYPE_DEFAULT);
HSP_SEQ_Rfft_f32(&hmw, FFT_Buffer, HSP_LOG2NBP_512, 0U, 1U, HSP_RFFT_TYPE_2, HSP_SEQ_IOTYPE_DEFAULT);
HSP_SEQ_StopRecordPL(&hmw);
--snip--
HSP_SEQ_RunTask(&hmw, PROC_IN, PRC_TIMEOUT);and the results are not the same. If I delete the RFFT operations from both, leaving just the VectMul then I do get identical results which tells me that the RFFTs are behaving differently between accelerator and sequencer modes.
Any suggestions? Are there differences in the parameters between the ACC and SEQ versions of the RFFT function that I need to be aware of?
Solved! Go to Solution.
2026-05-13 11:01 PM
OK, I've figured it out: I needed to wait for the process list to run to completion. Although the HSP_SEQ_RunTask() function docs suggest that it's a blocking call, it actually starts the process list and returns quickly. It's then necessary to have the process list set a flag and the CPU needs to poll for that flag before using the outputs. So the code will look like this:
HSP_SEQ_StartRecordPL(&hmw, 1);
HSP_SEQ_VectMul_f32(&hmw, FFT_Buffer, Window, FFT_Buffer, HSP_BLKSZ, HSP_SEQ_IOTYPE_DEFAULT);
HSP_SEQ_Rfft_f32(&hmw, FFT_Buffer, HSP_LOG2NBP_512, 0U, 1U, HSP_RFFT_TYPE_2, HSP_SEQ_IOTYPE_DEFAULT);
HSP_SEQ_SetFlag(&hmw, 0); // assert flag 0
HSP_SEQ_StopRecordPL(&hmw);
--snip--
HSP_SEQ_RunTask(&hmw, 1, 100);
while((HSP1->PFCTEVT_ISR & 1) != 1U); // wait for flag 0
HSP1->PFCTEVT_ICR = 1U; // clear flag 0
There are higher-level functions in HAL to poll for events and flags, but this example is simple and fast.
So - asked and answered.
2026-05-13 11:01 PM
OK, I've figured it out: I needed to wait for the process list to run to completion. Although the HSP_SEQ_RunTask() function docs suggest that it's a blocking call, it actually starts the process list and returns quickly. It's then necessary to have the process list set a flag and the CPU needs to poll for that flag before using the outputs. So the code will look like this:
HSP_SEQ_StartRecordPL(&hmw, 1);
HSP_SEQ_VectMul_f32(&hmw, FFT_Buffer, Window, FFT_Buffer, HSP_BLKSZ, HSP_SEQ_IOTYPE_DEFAULT);
HSP_SEQ_Rfft_f32(&hmw, FFT_Buffer, HSP_LOG2NBP_512, 0U, 1U, HSP_RFFT_TYPE_2, HSP_SEQ_IOTYPE_DEFAULT);
HSP_SEQ_SetFlag(&hmw, 0); // assert flag 0
HSP_SEQ_StopRecordPL(&hmw);
--snip--
HSP_SEQ_RunTask(&hmw, 1, 100);
while((HSP1->PFCTEVT_ISR & 1) != 1U); // wait for flag 0
HSP1->PFCTEVT_ICR = 1U; // clear flag 0
There are higher-level functions in HAL to poll for events and flags, but this example is simple and fast.
So - asked and answered.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.