cancel
Showing results for 
Search instead for 
Did you mean: 

Tried stepbystep (Intro to UART) from stm32 website, build and debugging are a success but keeps shutting down before even sending out "HelloWorld" to TeraTerm. What could be the problem?

LGuan.3
Associate

Hi all, im a beginner on stm32 (currently using l703rz) to play with. I have tried the code from stm32 stepbystep (Intro to UART), the build and debugging are a success. The problem is that it keeps shutting down after debugging and would not send out "HelloWorld" to my teraterm. The ports connected are same (115200 and 8 bits).

Anyways, here are the code that i newly tried

 uint8_t Test[] = "Hello World !!!\r\n"; //Data to send

 HAL_UART_Transmit(&huart2,Test,sizeof(Test),10);// Sending in normal mode

 HAL_Delay(1000);

Below here is the output after i tested these lines of code above.

STMicroelectronics ST-LINK GDB server. Version 7.1.0

Copyright (c) 2022, STMicroelectronics. All rights reserved.

Starting server with the following options:

    Persistent Mode      : Disabled

    Logging Level       : 1

    Listen Port Number     : 61234

    Status Refresh Delay    : 15s

    Verbose Mode        : Disabled

    SWD Debug         : Enabled

    InitWhile         : Enabled

Waiting for debugger connection...

Debugger connected

Waiting for debugger connection...

Debugger connected

Waiting for debugger connection...

   -------------------------------------------------------------------

            STM32CubeProgrammer v2.12.0          

   -------------------------------------------------------------------

Log output file:  C:\Users\Alpha\AppData\Local\Temp\STM32CubeProgrammer_a07796.log

ST-LINK SN : 066AFF353638425043085244

ST-LINK FW : V2J40M27

Board    : NUCLEO-L073RZ

Voltage   : 3.24V

SWD freq  : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID  : 0x447

Revision ID : Rev Z

Device name : STM32L07x/L08x/L010

Flash size : 192 KBytes

Device type : MCU

Device CPU : Cortex-M0+

BL Version : 0x41

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_a07796.srec

 File     : ST-LINK_GDB_server_a07796.srec

 Size     : 10.43 KB 

 Address    : 0x08000000 

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 83]

Download in Progress:

File download complete

Time elapsed during download operation: 00:00:01.346

Verifying ...

Download verified successfully 

Shutting down...

Exit.

3 REPLIES 3

Ok so the programming of the code to the board seems to complete.

i​f you press the reset button does your code run then?

A​re you starting in the debugger?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

Good day,sir. I have noticed and found out that it was a very very simple mistake that should not be made when referring to stepbystep guide as i missed the most important part. The problem had been solved and the shutting down command invokes is for the ide itself. I once again apologize for my silly mistake.

Btw,sir, is there any place where i can learn the gpio and adc function? I am currently trying to get voltage reading from ph sensor (ph4502c) into my l073rz, but the voltage reading keeps going higher ​than usual. For example, if I use arduino uno,I can get the pH sets at 2.5v (ph7) and can even adjusts the pot 1 near bmc connector while in stm32 l073rz i seem to not able to do so when the reading is higher than its supposed to and the value is not stable at all. The connection of pH sensor goes like this

Ph sensor ​ nucleol073rz

V+ = 5v

Gnd = gnd

Po = pa1 (pin)​

The sensor PH-4502C is supplied with 5V and also outputs voltages up to 5V, which you cannot measure directly with a 3.3V supplied STM32. To convert its larger voltage range to the range for STM32, you need a matching circuit, in the simplest case a voltage divider or one with an opamp as a voltage follower.

In addition, the reference voltage of the NUCLEO-L073RZ is connected to VDD (which can vary), so you always measure ratiometrically. For an absolute value measurement you have to:

  1. calibrate the ADC (always necessary)
  2. determine the value of the voltage at an ADC input
  3. determine the value of the internal (or an external) reference voltage
  4. set both values in relation to each other and determine the absolute value of step 2

Hope it helps?

Regards

/Peter

In order 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.