VS Arduino
Visual Micro >> Usb/Serial/WiFi Debugging >> Confused by ‘Serial1’
https://www.visualmicro.com/forums/YaBB.pl?num=1625501359

Message started by sstm.. on Jul 5th, 2021 at 4:09pm

Title: Confused by ‘Serial1’
Post by sstm.. on Jul 5th, 2021 at 4:09pm
It doesn't work when I use ‘Serial1’.

Compiling 'test' for 'Generic STM32F1 series'

Error linking for board Generic STM32F1 series
Build failed for project 'test'

ld.exe: test.cpp.o: in function vTest(void*)
test.ino: (.text._ZL5vTestPv+0x4c): undefined reference to Serial1

ld.exe: test.cpp.o: in function setup
test.ino: (.text.setup+0x54): undefined reference to Serial1

ld.exe: test.cpp.o: in function vTest2(void*)
test.ino: (.text._ZL6vTest2Pv+0x3c): undefined reference to Serial1

collect2.exe*: error: ld returned 1 exit status


And when I use ‘Serial’,it doesn't display any data.
e__e__zh__e___2021-07-06_000700.jpg ( 30 KB | 3 Downloads )

Title: Re: Confused by ‘Serial1’
Post by Simon@Visual Micro on Jul 5th, 2021 at 4:52pm
Thanks for the report.

Can you attach the full build output with the vMicro > Compiler > Verbose, and Show Build Properties options Enabled?

Title: Re: Confused by ‘Serial1’
Post by sstm.. on Jul 6th, 2021 at 2:34pm
Here is the output.
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=output_059.txt ( 808 KB | 3 Downloads )

Title: Re: Confused by ‘Serial1’
Post by Simon@Visual Micro on Jul 6th, 2021 at 3:21pm
Thanks for the log detail.

Note - This also happens when trying a simple sketch in the Arduino IDE, so believe this board/configuration does not have the Serial1 object available.

Both Serial and Serial2 work for this setup, and believe this is linked to the different Serial port mappings happening in the background in the STM Cores and setup.
https://github.com/stm32duino/wiki/wiki/API#hardwareserial

The example in the above link implies this has to be declared in the sketch, or the build options changed to force it to be automatically mapped.

Title: Re: Confused by ‘Serial1’
Post by sstm.. on Jul 6th, 2021 at 5:38pm
It's running! I'm very grateful for your timely help. :)

Title: Re: Confused by ‘Serial1’
Post by sstm.. on Jul 6th, 2021 at 6:16pm
Another question need help.When I use the 'Serial1',it can not print Chinese Characters.
But when I use 'Serial' in the Arduino IDE ,it works.(another project https://github.com/rogerclarkmelbourne/Arduino_STM32)

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.