Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Confused by ‘Serial1’ (Read 2058 times)
sstm..
Junior Member
**
Offline


Posts: 12
Joined: Jul 4th, 2021
Confused by ‘Serial1’
Jul 5th, 2021 at 4:09pm
Print Post  
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.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: Confused by ‘Serial1’
Reply #1 - Jul 5th, 2021 at 4:52pm
Print Post  
Thanks for the report.

Can you attach the full build output with the vMicro > Compiler > Verbose, and Show Build Properties options Enabled?
  
Back to top
 
IP Logged
 
sstm..
Junior Member
**
Offline


Posts: 12
Joined: Jul 4th, 2021
Re: Confused by ‘Serial1’
Reply #2 - Jul 6th, 2021 at 2:34pm
Print Post  
Here is the output.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: Confused by ‘Serial1’
Reply #3 - Jul 6th, 2021 at 3:21pm
Print Post  
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.
  
Back to top
 
IP Logged
 
sstm..
Junior Member
**
Offline


Posts: 12
Joined: Jul 4th, 2021
Re: Confused by ‘Serial1’
Reply #4 - Jul 6th, 2021 at 5:38pm
Print Post  
It's running! I'm very grateful for your timely help. Smiley
  
Back to top
 
IP Logged
 
sstm..
Junior Member
**
Offline


Posts: 12
Joined: Jul 4th, 2021
Re: Confused by ‘Serial1’
Reply #5 - Jul 6th, 2021 at 6:16pm
Print Post  
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)
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint