2021-09-28 11:22 PM - last edited on 2024-12-19 02:31 AM by SofLit
Hi,
I am developing on the Nucleo-wl55jc2 development board and I am trying to program the sub-GHz radio to transmit a continuous wave (not sending data packets, just a waveform). I have attached my code below along with a zip of the project. This code has been simplified from the 'SUBGHZ_Tx_Mode' example program that can be generated using the example selector when generating a new project.
I have tested both the 'SUBGHZ_Tx_Mode' example program and my code with a spectrum analyzer and a software-defined radio, and have not been able to pick up a transmission on either.
Any help is appreciated.
- Kevin
#define RADIO_MODE_STANDBY_RC 0x02
#define RADIO_MODE_BITFIELD 0x70
uint8_t RadioCmdSetFreq[4] = {0x1D, 0xCD, 0x65, 0x00}; // 500,000,000
uint8_t RadioResult = 0x00;
uint8_t RadioParam = 0x00;
uint8_t RadioMode = 0x00;
uint8_t RadioStatus = 0x00;
int main(void)
{
HAL_Init();
MX_SUBGHZ_Init();
/* Set Sleep Mode */
if (HAL_SUBGHZ_ExecSetCmd(&hsubghz, RADIO_SET_SLEEP, &RadioParam, 1) != HAL_OK)
{
Error_Handler();
}
/* Set Standby Mode */
if (HAL_SUBGHZ_ExecSetCmd(&hsubghz, RADIO_SET_STANDBY, &RadioParam, 1) != HAL_OK)
{
Error_Handler();
}
/* Retrieve Status from SUBGHZ Radio */
if (HAL_SUBGHZ_ExecGetCmd(&hsubghz, RADIO_GET_STATUS, &RadioResult, 1) != HAL_OK)
{
Error_Handler();
}
else
{
/* Format Mode and Status receive from SUBGHZ Radio */
RadioMode = ((RadioResult & RADIO_MODE_BITFIELD) >> 4);
/* Check if SUBGHZ Radio is in RADIO_MODE_STANDBY_RC mode */
if(RadioMode != RADIO_MODE_STANDBY_RC)
{
Error_Handler();
}
}
/* Set transmit frequency */
if (HAL_SUBGHZ_ExecSetCmd(&hsubghz, RADIO_SET_RFFREQUENCY, RadioCmdSetFreq, 4) != HAL_OK)
{
Error_Handler();
}
/* Set Tx Mode with continuous wave */
if (HAL_SUBGHZ_ExecSetCmd(&hsubghz, RADIO_SET_TXCONTINUOUSWAVE, NULL, 0) != HAL_OK)
{
Error_Handler();
}
while (1)
{ }
}
static void MX_SUBGHZ_Init(void)
{
hsubghz.Init.BaudratePrescaler = SUBGHZSPI_BAUDRATEPRESCALER_8;
if (HAL_SUBGHZ_Init(&hsubghz) != HAL_OK)
{
Error_Handler();
}
}
2024-12-19 02:24 AM
Hello @KImlay
I suggest you take a look at the projects of this Hotspot repository.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.