cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WL33KCV TCXO

nabilkontar
Associate II

Dear Experts,

 

I have an E04-400 module which contains a 48 MHz tcxo controlled through PB1 pin.

If i set the module to use HSI it can work (blinks an LED, radio is off)

If i set the module to use HSE (and set PB1 to 1 directly when main.c starts) the module doesn't even reach the stage where it is able to blink an LED.

 

I am using cubemx 6.17.0 to generate the code.

 

Here's part of main.c file

int main(void)
{
/* USER CODE BEGIN 1 */
// === CRITICAL: Power TCXO BEFORE any clock configuration ===
__HAL_RCC_GPIOB_CLK_ENABLE();
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_SET); // TCXO_EN = High

// Reliable delay on HSI (before SysTick/HAL_Init)
for(volatile uint32_t i = 0; i < 160000; i++); // ~10-15 ms
/* USER CODE END 1 */

/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();

/* USER CODE BEGIN Init */
/* USER CODE END Init */

/* Configure the system clock */
SystemClock_Config();

/* Configure the peripherals common clocks */
PeriphCommonClock_Config();

/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */

/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
MX_RTC_Init();
MX_MRSUBG_Init();

/* USER CODE BEGIN 2 */
//rf_tx_init();
/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
  HAL_Delay(500);
  HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin);

  //process_tx();
  /* USER CODE END WHILE */

/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}

void SystemClock_Config(void)
{
 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

 /** Initializes the RCC Oscillators according to the specified parameters
 * in the RCC_OscInitTypeDef structure.
 */
 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_HSI
   |RCC_OSCILLATORTYPE_LSE;
 RCC_OscInitStruct.HSEState = RCC_HSE_ON;
 RCC_OscInitStruct.LSEState = RCC_LSE_ON;
 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
 {
  Error_Handler();
 }

 /** Configure the SYSCLKSource and SYSCLKDivider
 */
 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_DIRECT_HSE;
 RCC_ClkInitStruct.SYSCLKDivider = RCC_DIRECT_HSE_DIV1;
 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_WAIT_STATES_1) != HAL_OK)
 {
  Error_Handler();
 }
}

Edited to apply source code formatting - please see How to insert source code for future reference.

4 REPLIES 4
Andrew Neil
Super User

@nabilkontar wrote:

I have an E04-400 module which contains a 48 MHz tcxo 


You mean this: https://ebyteiot.com/products/e04-400m16s-s2-lp-rf-wireless-transceiver-module-433m-low-power-consumption-470mhz-long-range-spi-module ?

 

That's a 3rd-party product - not ST's - so you really need to go to EBYTE (the manufacturer) for support:

https://ebyteiot.com/pages/contact-us

 

Have you checked their documentation for advice on how to use the TCXO ?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
nabilkontar
Associate II

No it is an STM32WL33KCV mcu with a 48 MHz HSE TCXO.

When configured to run from HSI it works (can blink an LED). When HSE is enabled and configured to run the same code it does not. So i assumed it is something related to TCXO.

Note i also have NUCLEO-WL-33CC2 and it's working like a charm. Tx and Rx and everything...

So the question is when using a TCXO on STM32WL33KCV (and that TCXO is controlled by PB1), is there a specific sequence to initialize the code?

 

I know it is not ST's product, but would appreciate guidance here.

 

Thank you!

 

nabilkontar
Associate II

It's a E04-400M20S


@nabilkontar wrote:

So the question is when using a TCXO on STM32WL33KCV (and that TCXO is controlled by PB1), is there a specific sequence to initialize the code?


Again, that's the 3rd-party's design - so you really need to ask them about it.

Have you checked their documentation for any guidance, recommendations, etc.

 


@nabilkontar wrote:

Note i also have NUCLEO-WL-33CC2 and it's working like a charm.


And is that running with an external clock?

The only thing the STM32 actually cares about is that it's an external clock signal - it neither knows nor cares about the source of the clock.

As for any external oscillator, The HSE will need to be in bypass mode.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.