SoftwareSerial

Please do not post requests
RonC
Posts: 12
Joined: Mon Sep 21, 2015 7:32 pm

Re: SoftwareSerial

Post by RonC » Mon Sep 21, 2015 10:48 pm

One of the reasons I'm using STM32 is more hardware serial but I'm currently working on a project I originally wrote for ATMEGA328 which uses 4 serial outputs, 2 inputs, plus the hardware serial port. So arduino newsoftserial worked perfectly since each input and output was only used one at a time (except the hardware port).

Anyhow, before I dive in, has anyone ported a software serial to STM32 yet? The simple modification mentioned in this thread obviously won't work for my application since I need the equivalent of 5 independent serial ports to get all the outputs I need.

Thanks!

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

Re: SoftwareSerial

Post by RogerClark » Wed Sep 23, 2015 6:14 am

I dont recall it being ported. I think people just wrote wrappers and use Hardware serial, rather than truely having software serial

RonC
Posts: 12
Joined: Mon Sep 21, 2015 7:32 pm

Re: SoftwareSerial

Post by RonC » Wed Sep 23, 2015 7:01 am

RogerClark wrote:I dont recall it being ported. I think people just wrote wrappers and use Hardware serial, rather than truely having software serial
Thanks Roger. Yes, that won't work for this project for reasons I outlined above. I expected that to be the case so I went ahead and started on it today. The modifications aren't too bad. I'm modifying it with #ifdef so the same sources will work for avr as well as stm32f1. It compiles now without errors so the next step is to get the scope out and get the timing right. I'm using the "newsoftserial" sources because you can have as many independent serial ports as you want and it doesn't use any timers making it less troublesome. It does disable interrupts though which I don't like (which works ok on the AVR for this application) and the only way around that is to use timers which can be troublesome if they are used for other purposes. I'll do a version which uses timers and leaves interrupts enabled when I get around to it - and probably leverage the altsoftserial that already exists for Teensy3.

BTW, off topic and we can take this to another thread but having been an STM32 m3 fan for quite awhile, I finally played with Teensy3.1 and it's pretty cool except for the crazy board/pin layout (and the price). Also it's m4 and the Kinetis stuff has some improved features over STM. Anyway, it occurred to me that it might be advantageous to layout the stm "hardware" folders similar to the Teensy3 stuff just to make life easier and more maintainable. As well, I've already found that have been able to leverage some of the Teens3 library sources includes. For instance, copying the entire util/ folder to Maple.. It might be worth trying to use as much of the Teensy3 stuff as possilbe since that's in pretty broad use and seems to have a bit more compatibility with AVR/Arduino. Just some thoughts.

Cheers,
ROn

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

Re: SoftwareSerial

Post by RogerClark » Wed Sep 23, 2015 8:04 am

Thanks Ron

Software serial could be handy, especially if it will operate at low speeds e.g. 1200 baud, as I recall someone else having issues on low speeds because it was not possible to set the serial clock dividers to a value that would give really low baud rates


Re: Folder organisation

Its got bloated over time.

I think I could ditch the F3 stuff, no one is using it at all.

I did think of having everything core as a separate sub module on GitHub, but I've realised that GitHub doesnt automatically put submodules in the zip file

So I now think that it would be better to use the GitHub "Releases" system to script up individual downloads eg. for the F1 and for the GD32 etc separately, and probably do a Boards Manager package

When I have time...

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

Re: SoftwareSerial

Post by mrburnette » Thu Sep 24, 2015 2:51 pm

Gee,

I thought I did... for the Adafruit GPS lib stuff...
I need to check.

Ray

Yes,
Originally posted here:
http://www.stm32duino.com/viewtopic.php?t=6

The lesson to learn here is that this forum is now large enough that a Google search by site is highly recommended before asking a question... even those of us here since the dark ages cannot remember everything. If you do notknow how to search Google by site, just ask Google.

It is downloadable from here: https://www.hackster.io/rayburne/color- ... time-clock

Code: Select all

 the STM32 Maple Mini board and microcontroller.  The current directory name is GPS_Time_Baro

Untitled file	
/*Please review License.h tab for use/rights information regarding included libraries
  GPS_Time_Baro based on original sketch by M. Ray Burnette 3/02/2014
  Arduino 1.6.1 - Maple Mini Port STM32F103 by Ray Burnette 3/09/2015 PUBLIC DOMAIN by Author
    Sketch uses 46,360 bytes (42%) of program storage space. Maximum is 108,000 bytes.
    Global variables use 5,752 bytes of dynamic memory.
*/

#include <SPI.h>                                     // \Documents\Arduino\hardware\STM32\STM32F1\libraries\SPI
#include <Wire.h>                                    // I2C \Documents\Arduino\hardware\STM32\STM32F1\libraries\Wire (legacy)
#include <Streaming.h>                               // \Documents\Arduino\libraries\Streaming (legacy)

#include ".\BMP085.h"                                // #include "I2Cdev.h" is pulled in also
#include ".\Adafruit_GPS.h"
#include ".\Adafruit_GFX.h"
#include ".\Adafruit_ILI9341.h"
#include ".\SoftwareSerial.h"                        // faux version only for STM32 Maple
#include ".\Utilities.h"

RonC
Posts: 12
Joined: Mon Sep 21, 2015 7:32 pm

Re: SoftwareSerial

Post by RonC » Wed Oct 07, 2015 4:32 am

mrburnette wrote:Gee,

I thought I did... for the Adafruit GPS lib stuff...
I need to check.

Ray

Yes,
Originally posted here:
http://www.stm32duino.com/viewtopic.php?t=6

The lesson to learn here is that this forum is now large enough that a Google search by site is highly recommended before asking a question... even those of us here since the dark ages cannot remember everything. If you do notknow how to search Google by site, just ask Google.
I did find your thread but as far as I can tell it doesn't do anything but instantiate a hardware serial port. Not useful for my application which actually needs another serial port. It needs four tx only ports, two rx only ports, and a bi-directional port for a total of 4 bi-directional serial ports. Appears you missed my post explaining that....

Cheers,
Ron

konczakp
Posts: 191
Joined: Thu Jul 14, 2016 4:17 pm

Re: SoftwareSerial

Post by konczakp » Mon Nov 07, 2016 8:16 pm

I would like to refresh this topic. Someone has got fully working/ported SoftwareSerial library? I've spotted this : https://github.com/wingspinner/SoftSerialIntAP but didn't tried that one yet. I have only few pins left on my maple mini and I need to get the software serial working.

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

Re: SoftwareSerial

Post by RogerClark » Mon Nov 07, 2016 9:13 pm

Very interesting.

I have never seen that before. Its a shame that people write libraries like this and publish them, but dont tell anyone.

konczakp
Posts: 191
Joined: Thu Jul 14, 2016 4:17 pm

Re: SoftwareSerial

Post by konczakp » Tue Nov 08, 2016 7:55 pm

RogerClark wrote:I have never seen that before
I'm pretty sure You have seen it : http://www.stm32duino.com/viewtopic.php?f=13&t=864
I have found it today while searching for another way of solving my problems

Unfortunately I was not able to get this run :( I've tried every timer 1-4 but every time it was freezing my whole program after a few seconds (as I mentioned I'm using almost every pin on maple mini). I've also checked if there is any communication via LogicAnalizer but unfortunately there is only "enjoy the silence" Anyone tried this SoftSerialIntAP ? Or is there a working softserial ?

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

Re: SoftwareSerial

Post by RogerClark » Tue Nov 08, 2016 8:52 pm

ok.

there are a lot of side projects, and I dont seem to be able to remember them all

Post Reply