Skip to main content
kolyandex
Associate
Oct 1, 2021 7:24 AM UTC
Question

SUBGHZ_Radio_IRQHandler Interrupt deadlock

Hi. I have a floating problem with subghz module interrupts.

In case of interrupt caused when MCU works with SUBGHZ module deadlock happened, because periph are locked by previous operation and we can't read interrupt status register of subghz. Is there any solution? Thanks in advance.

You can see call stack on a picture attached.

This topic has been closed for replies.

3 replies

Piranha
Principal III
Oct 1, 2021 9:01 PM UTC

That is a sacrifice to the god of incompetence!

https://community.st.com/s/question/0D50X0000C5Tns8SQC/bug-stm32-hal-driver-lock-mechanism-is-not-interrupt-safe

There is only one real solution - stop using the HAL/Cube broken bloatware and write real code.

kolyandex
kolyandexAuthor
Associate
Oct 2, 2021 3:41 AM UTC

I understand that this is a bug of st. And the purpose of this message is to hope that they will fix it.

YBOUV.1
ST Employee
Oct 12, 2021 2:21 PM UTC

Hi @kolyandex​ ,

You are taking an interrupt when the radio is initialized.

1/looking at the code, it seems that the interrupt should not be active yet :

static void RadioInit( RadioEvents_t *events )
{ /* init*/
 SUBGRF_Init( RadioOnDioIrq );
 
 /* ....*/
 
 /*Activate the ITs*/
 SUBGRF_SetDioIrqParams( IRQ_RADIO_ALL, IRQ_RADIO_ALL, IRQ_RADIO_NONE, IRQ_RADIO_NONE )
}

Do you call radioInit() while the radio is active?

2/Also, in cube WL 1.1.0, a fix has been implemented so that all radio accesses are done within critical section ( snippet below)

This was to avoid this kind of situation. Are you using cube WL 1.0.0?

void SUBGRF_WriteRegisters( uint16_t address, uint8_t *buffer, uint16_t size )
{
 CRITICAL_SECTION_BEGIN();
 HAL_SUBGHZ_WriteRegisters( &hsubghz, address, buffer, size );
 CRITICAL_SECTION_END();
}
 
void SUBGRF_ReadRegisters( uint16_t address, uint8_t *buffer, uint16_t size )
{
 CRITICAL_SECTION_BEGIN();
 HAL_SUBGHZ_ReadRegisters( &hsubghz, address, buffer, size );
 CRITICAL_SECTION_END();
}
 
void SUBGRF_WriteBuffer( uint8_t offset, uint8_t *buffer, uint8_t size )
{
 CRITICAL_SECTION_BEGIN();
 HAL_SUBGHZ_WriteBuffer( &hsubghz, offset, buffer, size );
 CRITICAL_SECTION_END();
}
 
void SUBGRF_ReadBuffer( uint8_t offset, uint8_t *buffer, uint8_t size )
{
 CRITICAL_SECTION_BEGIN();
 HAL_SUBGHZ_ReadBuffer( &hsubghz, offset, buffer, size );
 CRITICAL_SECTION_END();
}
 
void SUBGRF_WriteCommand( SUBGHZ_RadioSetCmd_t Command, uint8_t *pBuffer,
 uint16_t Size )
{
 CRITICAL_SECTION_BEGIN();
 HAL_SUBGHZ_ExecSetCmd( &hsubghz, Command, pBuffer, Size );
 CRITICAL_SECTION_END();
}
 
void SUBGRF_ReadCommand( SUBGHZ_RadioGetCmd_t Command, uint8_t *pBuffer,
 uint16_t Size )
{
 CRITICAL_SECTION_BEGIN();
 HAL_SUBGHZ_ExecGetCmd( &hsubghz, Command, pBuffer, Size );
 CRITICAL_SECTION_END();
}

let me know