Serial Port error

Generic boards that are not Maple or Maple mini clones, and don't contain the additional USB reset hardware
Post Reply
peeknot
Posts: 24
Joined: Thu Dec 14, 2017 3:08 pm

Serial Port error

Post by peeknot » Thu Feb 08, 2018 2:31 pm

Everytime I open the port I got this error
Error while setting serial port parameters: 9,600 N 8 1
or I cant see any outputs from the serial. Any possibilities why this occurs?

Im using "bluepill" arduino ide 1.8.4 in windows 8.1

stevestrong
Posts: 2070
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Serial Port error

Post by stevestrong » Thu Feb 08, 2018 4:23 pm

Check the device manager, whether the drivers for the serial COM port are installed or not.

User avatar
mrburnette
Posts: 2226
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Serial Port error

Post by mrburnette » Thu Feb 08, 2018 8:40 pm

peeknot wrote:
Thu Feb 08, 2018 2:31 pm
<...>
Im using "bluepill" arduino ide 1.8.4 in windows 8.1
Are you using a USB-serial adapter or have you moded the blue pill to do serial over the on board USB connector?
From the WiKi:
Hardware installation
BluePillUsbResistor.jpg
The USB standard requires a 1.5 kΩ pullup resistor on D+, but this board is known to have a wrong value (R10 on the board). It ships with either a 10 kΩ resistor or a 4.7 kΩ resistor, but it should be replaced with a 1.5 kΩ resistor, or put an appropriate resistor value (e.g 1.8 kΩ) in between PA12 and 3.3V. It is also true that some PCs are tolerant of incorrect value so, before you change the resistance, you can try if it works in your case.

peeknot
Posts: 24
Joined: Thu Dec 14, 2017 3:08 pm

Re: Serial Port error

Post by peeknot » Fri Feb 09, 2018 4:05 am

mrburnette wrote:
Thu Feb 08, 2018 8:40 pm
Are you using a USB-serial adapter or have you moded the blue pill to do serial over the on board USB connector?
Im using the on board usb connector

peeknot
Posts: 24
Joined: Thu Dec 14, 2017 3:08 pm

Re: Serial Port error

Post by peeknot » Fri Feb 09, 2018 5:59 am

And theres a case after opening serial port even I have something in my code that needs to print in serial monitor nothing appears.

stevestrong
Posts: 2070
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Serial Port error

Post by stevestrong » Fri Feb 09, 2018 8:27 am

Be aware that on Windows 8/10 needs at least 5 seconds for reenumerating the serial COM port after the DFU port was used before on USB.
So in your code you can use:

Code: Select all

void setup
{
  Serial.begin(); // not really needed for USB serial, just for the sake of completeness
  while ( !Serial ); // wait for the serial monitor
  Serial.println("This is now visible in serial monitor");
  // do more stuff
  ...
}
and the serial printouts will be visible in the serial monitor.

User avatar
mrburnette
Posts: 2226
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Serial Port error

Post by mrburnette » Fri Feb 09, 2018 1:21 pm

peeknot wrote:
Fri Feb 09, 2018 4:05 am
mrburnette wrote:
Thu Feb 08, 2018 8:40 pm
Are you using a USB-serial adapter or have you moded the blue pill to do serial over the on board USB connector?
Im using the on board usb connector
If using the onboard USB, then you may have to modify a blue board to properly enumerate. Varioius posts have been dedicated to discussing the problem... some users report not having to mod a board and other users report that it is necessary. Therefore, in my opinion, I think it all has to do with your local development PC and environment. The relevant link is: http://wiki.stm32duino.com/index.php?title=Blue_Pill

Summary:
Hardware installation
BluePillUsbResistor.jpg
The USB standard requires a 1.5 kΩ pullup resistor on D+, but this board is known to have a wrong value (R10 on the board). It ships with either a 10 kΩ resistor or a 4.7 kΩ resistor, but it should be replaced with a 1.5 kΩ resistor, or put an appropriate resistor value (e.g 1.8 kΩ) in between PA12 and 3.3V. It is also true that some PCs are tolerant of incorrect value so, before you change the resistance, you can try if it works in your case.


Software installation
A bootloader needs to be flashed using USB to Serial or ST-Link (SWD). See Flashing the bootloader

Follow the normal Installation guide.

Note that after first flashing the bootloader you may have to place the board into "perpetual bootloader" mode before you can upload a sketch; place a resistor between pin PC14 and 3.3V, and then reset the board. You should now be able to flash a blank sketch, remove the resistor, and restart the board, after which uploading new sketches should work as expected. If you find that the IDE successfully resets your board, but dfu-util complains about no DFU-devices being present you may have to edit the maple-upload script in tools-folder. Find the line where it calls upload-reset, and increase the value given to it.
There were some early posts that had some pictures of hacks such as soldering parallel resistor across the factory installed one to get close to the proper value. This seems to be the easy way for folks that cannot do SMT board work. One inventive member came up with a 'fix' to mimic the reset circuitry of the Maple Mini: viewtopic.php?p=12933#p12933

There is a very good reason that the forum suggests that beginning STM32duino users purchase a Maple Mini clone even if 33% to 50% more expensive than the blue pill ... the Maple Mini generally works best with the various operating systems for reset and it is not 100% which has been a problem for more than one member who wanted to use them for educational purposes where 100% correct uploading was a requirement.

Ray

peeknot
Posts: 24
Joined: Thu Dec 14, 2017 3:08 pm

Re: Serial Port error

Post by peeknot » Fri Feb 09, 2018 5:19 pm

mrburnette wrote:
Fri Feb 09, 2018 1:21 pm

Therefore, in my opinion, I think it all has to do with your local development PC and environment. The relevant link is: http://wiki.stm32duino.com/index.php?title=Blue_Pill
This might be the reason why, thanks mr Ray


Regards

ren

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

Re: Serial Port error

Post by RogerClark » Fri Feb 09, 2018 8:37 pm

Note.

For Serial USB , the baud rate and other settings are ignored. These settings only apply to devices which have a direct hardware serial output from the USB data.

User avatar
mrburnette
Posts: 2226
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Serial Port error

Post by mrburnette » Sat Feb 10, 2018 12:31 am

RogerClark wrote:
Fri Feb 09, 2018 8:37 pm
... For Serial USB , the baud rate and other settings are ignored. These settings only apply to devices which have a direct hardware serial output from the USB data.
Affirmative, General Examples explicitly state same:

Code: Select all

Serial.begin(BAUD);  // BAUD has no effect on USB serial: placeholder for physical USART
But, getting members to actually read through the examples is simply not guaranteed.

Ray

Post Reply