"Serial" now works out-of-the-box on the USB-serial port of the Nucleo F103RB.

Post Reply
User avatar
RogerClark
Posts: 6684
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

"Serial" now works out-of-the-box on the USB-serial port of the Nucleo F103RB.

Post by RogerClark » Mon Jul 03, 2017 6:57 am

https://github.com/rogerclarkmelbourne/ ... 2/pull/240

Nucleo user needed to comment on this

User avatar
Rick Kimball
Posts: 989
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: "Serial" now works out-of-the-box on the USB-serial port of the Nucleo F103RB.

Post by Rick Kimball » Fri Sep 01, 2017 7:55 pm

Doesn't seem to work right.

I made the following change to make it act right:

Code: Select all

$ git diff variants/nucleo_f103rb/
diff --git a/STM32F1/variants/nucleo_f103rb/board.cpp b/STM32F1/variants/nucleo_f103rb/board.cpp
index 9f3e08a..cc71179 100644
--- a/STM32F1/variants/nucleo_f103rb/board.cpp
+++ b/STM32F1/variants/nucleo_f103rb/board.cpp
@@ -253,7 +253,7 @@ MOSI alternate functions on the GPIO ports.
    DEFINE_HWSERIAL(Serial2, 2);
    DEFINE_HWSERIAL(Serial3, 3);
 #else
-   DEFINE_HWSERIAL(Serial, 3);// Use HW Serial 2 as "Serial"
-   DEFINE_HWSERIAL(Serial1, 2);
-   DEFINE_HWSERIAL(Serial2, 1);
-#endif
\ No newline at end of file
+   DEFINE_HWSERIAL(Serial, 2);// Use HW Serial 2 as "Serial"
+   DEFINE_HWSERIAL(Serial1, 1);
+   DEFINE_HWSERIAL(Serial2, 3);
+#endif
With the change above, the sketch below works properly with the NUCLEO VCP and 2 USB dongles.
(Serial on ) USART2 PA2/PA3 - using the VCP on the Nucleo F103RB board
(Serial1 on ) USART1 PA9/PA10 - using an external USB
(Serial2 on ) USART3 PC10/PC11 - using an external USB

Code: Select all

void setup() {
  Serial.begin(9600);  // USART2
  Serial1.begin(9600); // USART1
  Serial2.begin(9600); // USART3
}

void loop() {
  Serial.print((char)'U');
  Serial1.print((char)'1');
  Serial2.print((char)'2');
  delay(200);
}
Another problem is with the board.txt entry for the nucleo-f103rb ... The sizes are incorrect. They should be 20480 for ram and 131072 for Flash.

Code: Select all

$ git diff 
diff --git a/STM32F1/boards.txt b/STM32F1/boards.txt
index 6d110d0..a6bf523 100644
--- a/STM32F1/boards.txt
+++ b/STM32F1/boards.txt
@@ -283,8 +283,8 @@ nucleo_f103rb.name=STM Nucleo F103RB (STLink)
 
 nucleo_f103rb.upload.tool=stlink_upload
 nucleo_f103rb.upload.protocol=maple_dfu
-nucleo_f103rb.upload.maximum_size=108000
-nucleo_f103rb.upload.maximum_data_size=17000
+nucleo_f103rb.upload.maximum_size=131072^M
+nucleo_f103rb.upload.maximum_data_size=20480^M
 nucleo_f103rb.upload.use_1200bps_touch=false
 nucleo_f103rb.upload.file_type=bin
 nucleo_f103rb.upload.params.quiet=no
-rick

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest