2021-10-01 12:24 AM
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.
2021-10-01 02:01 PM
That is a sacrifice to the god of incompetence!
There is only one real solution - stop using the HAL/Cube broken bloatware and write real code.
2021-10-01 08:41 PM
I understand that this is a bug of st. And the purpose of this message is to hope that they will fix it.
2021-10-12 07:21 AM
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