Re: Can't open serial monitor using ST Link and STM32F103C8
Posted: Fri Jan 10, 2020 4:57 pm
before doing a 'reset' , a few more things to try:
after following the instructions, connect usb - press reset on the pill board
in device manager did windows find a usb dfu device ? you can try the next steps nevertheless
if it did in the (arduino) IDE
make a sketch e.g.
- select the board 'Generic STM32F103C Series'
- variant select 'STM32F103C8 20k ram 64k flash'
- select upload method "STM32duino bootloader"
- cpu speed: normal 72mhz
- optimise method: smallest default
build and install the sketch
then press reset (on the pill board)
it should blink
open a serial terminal, you can use that in the arduino ide if you are using it
send some characters
if you are hitting some issues installing the sketch, you can try to set the BOOT1 jumper on the board, press reset (on pill board)
with the stm32duino boot loader alone, it should keep blinking
then try to install the sketch from the IDE again
after installing, revert BOOT1 jumper to original, press reset, this time round the sketch should be running i.e. it is blinking
open a serial terminal and send some characters.
to proof that it is the sketch that is running, you can change the delay(100) statement in loop(), to a different value e.g. delay(1000),
that would make it blink on and off every second
in terms of 'resetting' the pill board to 'original', here is what it is:
when you install firmware using st-link e.g. the boot loader, that is the firmware / sketch that runs on the pill board (chip)
it replaces what is there and is the only thing that runs. normally the install location is 0x8000000 - start of flash
and if you install a firmware / sketch or bootloader there using st-link, that is the thing that runs
but if you are installing using a usb cable and the boot loader above, the boot loader places you sketch after itself (normally 0x8002000 for STM32duino bootloader) so that it won't over write itself. but that means you need to select the 'upload method STM32duino bootloader' when you build your sketch. This is because, it would build the sketch for the offset location of 0x8002000
after following the instructions, connect usb - press reset on the pill board
in device manager did windows find a usb dfu device ? you can try the next steps nevertheless
if it did in the (arduino) IDE
make a sketch e.g.
Code: Select all
uint8_t led = 0;
void setup() {
// Serial.begin(); //this isn't needed, it is pre-initialised , otherwise you could uncomment it to test
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
if(Serial.available()) {
char c = Serial.read();
Serial.print("hello ");
Serial.print(c);
Serial.println();
}
led = ~ led & 1;
digitalWrite(LED_BUILTIN, led);
delay(100);
}
- variant select 'STM32F103C8 20k ram 64k flash'
- select upload method "STM32duino bootloader"
- cpu speed: normal 72mhz
- optimise method: smallest default
build and install the sketch
then press reset (on the pill board)
it should blink
open a serial terminal, you can use that in the arduino ide if you are using it
send some characters
if you are hitting some issues installing the sketch, you can try to set the BOOT1 jumper on the board, press reset (on pill board)
with the stm32duino boot loader alone, it should keep blinking
then try to install the sketch from the IDE again
after installing, revert BOOT1 jumper to original, press reset, this time round the sketch should be running i.e. it is blinking
open a serial terminal and send some characters.
to proof that it is the sketch that is running, you can change the delay(100) statement in loop(), to a different value e.g. delay(1000),
that would make it blink on and off every second
in terms of 'resetting' the pill board to 'original', here is what it is:
when you install firmware using st-link e.g. the boot loader, that is the firmware / sketch that runs on the pill board (chip)
it replaces what is there and is the only thing that runs. normally the install location is 0x8000000 - start of flash
and if you install a firmware / sketch or bootloader there using st-link, that is the thing that runs
but if you are installing using a usb cable and the boot loader above, the boot loader places you sketch after itself (normally 0x8002000 for STM32duino bootloader) so that it won't over write itself. but that means you need to select the 'upload method STM32duino bootloader' when you build your sketch. This is because, it would build the sketch for the offset location of 0x8002000