‎2020-03-14 10:32 AM
This is the code:
/* USER CODE BEGIN WHILE */
while (1)
{
HAL_GPIO_WritePin(GPIOA , LED_Pin, GPIO_PIN_SET);
HAL_Delay(10);
HAL_GPIO_WritePin(GPIOA , LED_Pin, GPIO_PIN_RESET);
HAL_Delay(10);
char p[] = "128";
HAL_UART_Transmit(&huart2, (uint8_t*)p , sizeof(p), HAL_MAX_DELAY);
HAL_Delay(200);
}
This is the UART config:
/* USER CODE END USART2_Init 1 */
huart2.Instance = USART2;
huart2.Init.BaudRate = 9600;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart2) != HAL_OK)
{
Error_Handler();
}
The attachment show the clock configuration:
Solved! Go to Solution.
‎2020-03-24 04:03 AM
Below, i show RCC and USART2 registers. I see in RCC->CR register that HSE not ready (17th bit) and in CFGR HCLK divided by 16 (bit [13:8]). Someone can tell me another test for check of the clock functionality? I used uVision.
‎2020-03-24 10:28 AM
Someone can help me? I don't find the problem.
‎2020-03-24 11:01 AM
You are hard to help. You have no test equipment, you don't post a complete compilable project.
Check that the solder bridges (SB) for the MCO / HSE are present. This may depend on board version in uses, and most of the HAL examples for the NUCLEO-F103RB use HSI to clock at 64 MHz. Boards MB1136 C-01 don't have HSE connected.
Check
SB54 ON
SB55 OFF
SB16 ON
SB50 ON
>>HAL_UART_Transmit(&huart2, (uint8_t*)p , sizeof(p), HAL_MAX_DELAY);
Use strlen() or sizeof()-1 so you don't transmit the NUL characters
This uses USART1 via PA9 / PA10, clocks the board at 64 MHz, you could modify this
STM32Cube_FW_F1_V1.8.0\Projects\STM32F103RB-Nucleo\Examples\UART\UART_Printf
Would be usable with a USB-to-CMOS Serial type adapter from SiLabs, etc.
In the days prior to having a scope, I used a Logic Probe to identify High, Low, and Clocking signals.
‎2020-03-24 12:02 PM
Thanks clive1,
i have a MB1136 C-01 board and the oscillator HSE not present, I have read the document.
I had not pay attention because i thought use X1 oscillator.
I will satisfied of 64 MHz =)