Spark Logic

[SOLVED] Problems with Blue Pill board Serial1, Serial2, Serial3

Hello guys, As you can see i am new to this fourm.
I want to STM32F103CSTM32F103CMicrocontrollers and processors…doesnt work” mortenholm Fri Jul 24, 2015 10:05 pm Sure. I have selected the ‘Generic STM32F103C series’ and i have tried both the 64k and 128k versions (stm32flash reports 128k).…View in hardware catalog (Blue PillBlue PillDevelopment and computing boards…as become my new favorite board. I am calling it “blue pad” and it is kind of super “ blue pill ”. Pito Thu Jul 27, 2017 8:53 pm [victor_pv – Thu Jul 27, 2017 3:58 pm] – Just for…View in hardware catalog ) board to communicate with ESP8266ESP8266Microcontrollers and processors…working, on the Arduino.cc forum The ESP thing looks similar, but at the moment, www. esp8266 .com is not responding, so I’ll take a look later to see if it seems to be the same b…View in hardware catalog -12E and neo 6m GPS modules with Blue PillBlue PillDevelopment and computing boards…as become my new favorite board. I am calling it “blue pad” and it is kind of super “ blue pill ”. Pito Thu Jul 27, 2017 8:53 pm [victor_pv – Thu Jul 27, 2017 3:58 pm] – Just for…View in hardware catalog . And i have used this module before with Arduino UnoArduino UnoDevelopment and computing boards…ime debugging. konczakp Mon Jul 18, 2016 12:18 pm OK, so I took working example from Arduino UNO . I’ve cut off everything from library that I don’t need and from rest I have crea…View in hardware catalog and mega and get wanted results. but when i used Blue PillBlue PillDevelopment and computing boards…as become my new favorite board. I am calling it “blue pad” and it is kind of super “ blue pill ”. Pito Thu Jul 27, 2017 8:53 pm [victor_pv – Thu Jul 27, 2017 3:58 pm] – Just for…View in hardware catalog to communicate with ESP8266ESP8266Microcontrollers and processors…working, on the Arduino.cc forum The ESP thing looks similar, but at the moment, www. esp8266 .com is not responding, so I’ll take a look later to see if it seems to be the same b…View in hardware catalog -12E, it is not working through Serial1, Serial2, Serial3 (i have checked one by one). So i have made simple code which can check output of Serial2(or any one of the three).
as below,
char a;
void setup() {
Serial.begin(115200);
Serial2.begin(115200);
//our setup code here, to run once:
}
void loop() {
if(Serial2.available()>0)
{
a=Serial2.read();                  // will check Serial2 recevied data
}
Serial2.write("HII");              // will send to other serial monitor(in different pc)
Serial.println(a);
delay(1000);
// put your main code here, to run repeatedly:
}

Replies10

Mon Oct 08, 2018 5:06 am

What core are you using?

A quick search of the forum will give you quite a few versions of this – I had similar issues but solved them quickly by reading recent threads.
If using the STM core: viewtopic.php?f=3&t=4200
If using the LibMaple core (a.k.a. Roger’s Core) serial works out of the box.
If using the Generic Core you’re on your own, not a clue – I tried it first, realised the project isnt active and dropped it.

My advice if using Arduino for STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog is to read the basics here before doing anything else:

viewtopic.php?f=2&t=3111 “*** PLEASE READ THIS FIRST ****”

viewtopic.php?f=55&t=2465 “What STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog board should you buy”
http://wiki.stm32duino.com/index.php?title=API “API”
viewtopic.php?f=55&t=2471 “FAQ’s and links”

Mon Oct 08, 2018 5:50 am

If using the Generic Core you’re on your own, not a clue – I tried it first, realised the project isnt active and dropped it.

Probably this might help:
https://danieleff.github.io/STM32GENERIC/uart/

Mon Oct 08, 2018 12:52 pm

Normally bluepill users use Roger’s core and then this page makes sense: http://wiki.stm32duino.com/index.php?title=API

I did a GPS project with MM here.

I connected a Bluepill to a Raspberry PiRaspberry PiDevelopment and computing boards…ic stripe card reader. I’ve gutted it, extended the sides up to give more room for a raspberry pi , soundcard, and dc-dc power supply converter. I’m going to put a few knobs and a…View in hardware catalog here. (same concept as ESP8266ESP8266Microcontrollers and processors…working, on the Arduino.cc forum The ESP thing looks similar, but at the moment, www. esp8266 .com is not responding, so I’ll take a look later to see if it seems to be the same b…View in hardware catalog /ESP32ESP32Microcontrollers and processors…ith MM here. I connected a Bluepill to a Raspberry Pi here. (same concept as ESP8266/ ESP32 ) Ray /* BlinkNcount_BP3 by m. ray burnette Turns on an LED on for one second, then off…View in hardware catalog )

Ray

/*
BlinkNcount_BP3 by m. ray burnette

Turns on an LED on for one second, then off for one second, repeatedly.
Counts and displays the count on the attached serial monitor
Example is for Blue PillBlue PillDevelopment and computing boards…as become my new favorite board. I am calling it “blue pad” and it is kind of super “ blue pill ”. Pito Thu Jul 27, 2017 8:53 pm [victor_pv – Thu Jul 27, 2017 3:58 pm] – Just for…View in hardware catalog , outputs on all 3 serial ports
*/

int n = 0;
void setup() {
// initialize the digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
// Initialize virtual COM over USB on bluepill
Serial.begin(9600);  // BAUD has no effect on USB serial: placeholder for physical UART
Serial1.begin(9600);
Serial2.begin(9600);
// wait for serial monitor to be connected.
while (!Serial)
{
digitalWrite(LED_BUILTIN,!digitalRead(LED_BUILTIN)); // Turn the LED from off to on, or on to off
delay(100);         // fast blink
}
Serial.println("Blink LED & count Demo");
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);   // set the LED on
delay(500);              // wait for a second
digitalWrite(LED_BUILTIN, LOW);    // set the LED off
// Serial.print("Loop #: ");
n++;
Serial.print("Serial:  ")  ; Serial.println(n);
Serial1.print("Serial1:  ") ; Serial1.println(n);
Serial2.print("Serial2:  ") ; Serial2.println(n);
delay(500);              // wait
}

Mon Oct 08, 2018 2:12 pm

If you upload over serial, you don’t have USB serial defined per default.
This means that
Serial == USART1, and SERIAL2 == USART3.
Take this into consideration when choosing the pins to connect the serial interface.

Mon Oct 08, 2018 2:32 pm

I linked to the WiKi page, but in view of how important this is (thanks, Steve), I’m going to extract the WiKi info here:

Serial & USB Serial
Serial USB is enabled for all F103 boards when uploading using the bootloader, it is also available when uploading by ST-LINKST-LINKModules, instruments and finished devices…ot add the serial usb device… suspect flashing failed…. Do I need to debrick it with st-link ? (which I don’t have lol) BennehBoy Mon Jan 23, 2017 8:11 pm NM managed to rescue it…View in hardware catalog (SWD) In these cases:

Serial.print(“Hello world”); will print via Serial USB (CDC).
Serial1 prints to hardware USART 1
Serial2 prints to hardware USART 2
etc


When uploading via “Serial” (external USB to Serial adaptor connected to PA9 and PA10 (USART1) on the STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog ):

Serial.print(“Hello world”); will print to hardware USART1 (the one the code was uploaded using)
Serial1 prints to hardware USART 2
etc


Note. Some boards, e.g. NucleoNucleoDevelopment and computing boards…o have this dev board for BlueNRG at a pretty hefty price tag though, hopefully the ‘ nucleo ’ & common dev board versions would be out soon Laughing … 007v1.html oops/oh found an…View in hardware catalog F103RB have special serial mapping, because these boards need to have hardware modification to make Serial usable.

The Serial <-> USART mapping is defined in file “variants/<board_name>/board.cpp”.

ALL MEMBERS:
This is the 3rd time I or someone else has answered nearly identical “serial” questions in the past few days. I’m am annoyed because a forum/Google search will quickly return the information. When using Google against the site, use <terms> site:stm32duino.com

So, start searching. It’s actually easier to just block user access to the forum for 24 hours for members that abuse the site by flooding it with already-answered dialog.

Ray

Mon Oct 08, 2018 4:52 pm

Thank you for your suggestion ,
It worked for me.

Mon Oct 08, 2018 5:06 pm

[pareidolialjebus – Mon Oct 08, 2018 5:06 am] –
.. Generic Core ….,- I tried it first, realised the project isnt active and dropped it.

BTW.: That’s not correct. The Huaweixx branch is probably the branch where the most development takes place.

But … for some reason it does not work on my computer ….

Mon Oct 08, 2018 9:22 pm

Probably because you did not buy your computer from Supermicro or Apple. They reportedly have a special Chinese chip :-)

Mon Oct 08, 2018 9:30 pm

[ChrisMicro – Mon Oct 08, 2018 5:06 pm] –
[pareidolialjebus – Mon Oct 08, 2018 5:06 am] –
.. Generic Core ….,- I tried it first, realised the project isnt active and dropped it.

BTW.: That’s not correct. The Huaweixx branch is probably the branch where the most development takes place.

But … for some reason it does not work on my computer ….

Good to know – I took my info from here: viewtopic.php?f=2&t=3111

“3. An alternative generic core: *OUTDATED not under development anymore * edited: 23.08.2013
https://github.com/danieleff/STM32GENERIC“

Mon Oct 08, 2018 10:24 pm

[pareidolialjebus – Mon Oct 08, 2018 9:30 pm] –
[ChrisMicro – Mon Oct 08, 2018 5:06 pm] –
[pareidolialjebus – Mon Oct 08, 2018 5:06 am] –
.. Generic Core ….,- I tried it first, realised the project isnt active and dropped it.

BTW.: That’s not correct. The Huaweixx branch is probably the branch where the most development takes place.

But … for some reason it does not work on my computer ….

Good to know – I took my info from here: viewtopic.php?f=2&t=3111

The item #3 is correct… going off and finding some non-member, similar core on github does not mean that it is a substitute for Daniel’s core – a core which is basically a wrapper around HAL. Now that STM has a nicely evolved Official Core, there really are only two (2) actively supported cores from this forum viewpoint – deviate if you will, but you will be in self-supported waters.

Ray

Post a reply

Optional · up to 10 MiB