cancel
Showing results for 
Search instead for 
Did you mean: 

Noise due data transmission using UART on STM32L476RE

LRosa.1
Associate

In my project, I'm using the STM32L476RELQFP64 microcontroller to process data from an external ADC that communicates via SPI. The objective is to transmit this processed data to a display using UART. However, I'm facing difficulties with the data transmission over UART. Whenever I transmit the data from the STM32L476RE to the display, it introduces noise in my power supply rails. This noise (transient voltage drop of 3mV) is only observed during the data transmission from the microcontroller to the display, and not when data is sent from the display to the microcontroller.

This noise in my supply rails is affecting my ADC's measurement, which needs to acquire voltages in the range of hundreds of microvolts.

My board is supplied by a 12V battery bank, but when it was fed by a benchtop power supply (for test purposes only), I could see that during the UART transmission the whole board current consumption increased about 10mA.

The STM32L476RE power supply is 3.3V (from LD2981). The ADC digital power supply is the same 3.3V, the analog power supply is 5V (from LP2985). I'm using two ground planes here, one for digital and one for analog. They are tied together in a single point in my PCB, as described in my ADC's datasheet. I have one 100nF decoupling capacitor close to every single supply voltage pin of the microcontroller (VBAT, VDDA, 3xVDD and VDDUSB). The linear 3.3 voltage regulator has an output capacitor of 20uF. This linear regulator is fed by a 5V buck converter (LM2576-5) from the 12V battery bank.The UART bus goes right to the display without any series resistors or pull ups. (I’ve tried 47 Ohm in series with Tx and Rx, but without success)

I'm using UART4, and the init function generated by STMCubeIDE can be seen below.

void MX_UART4_Init(void)

{

  /* USER CODE BEGIN UART4_Init 0 */

  /* USER CODE END UART4_Init 0 */

  /* USER CODE BEGIN UART4_Init 1 */

  /* USER CODE END UART4_Init 1 */

  huart4.Instance = UART4;

  huart4.Init.BaudRate = 9600;

  huart4.Init.WordLength = UART_WORDLENGTH_8B;

  huart4.Init.StopBits = UART_STOPBITS_1;

  huart4.Init.Parity = UART_PARITY_NONE;

  huart4.Init.Mode = UART_MODE_TX_RX;

  huart4.Init.HwFlowCtl = UART_HWCONTROL_NONE;

  huart4.Init.OverSampling = UART_OVERSAMPLING_16;

  huart4.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;

  huart4.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;

  if (HAL_UART_Init(&huart4) != HAL_OK)

  {

    Error_Handler();

  }

  /* USER CODE BEGIN UART4_Init 2 */

  /* USER CODE END UART4_Init 2 */

}

I’m also using the HAL library to transmit data. The function used can be seen below:

void NX3224T028_011_SendFloat(char *obj, float num, int dp)

{

uint8_t Cmd_End[3] = {0xff, 0xff, 0xff};

  int32_t number = num*(pow(10,dp));

  uint8_t *buffer = malloc(30*sizeof (char));

  int len = sprintf ((char *)buffer, "%s.vvs1=%d", obj, dp);

  HAL_UART_Transmit(&huart4, buffer, len, 1000);

  HAL_UART_Transmit(&huart4, Cmd_End, 3, 100);

  len = sprintf ((char *)buffer, "%s.val=%ld", obj, number);

  HAL_UART_Transmit(&huart4, buffer, len, 1000);

  HAL_UART_Transmit(&huart4, Cmd_End, 3, 100);

  free(buffer);

}

The drop in the supply rails occurs when this NX3224T028_011_SendFloat(...) is called.

0 REPLIES 0