GrumpyOldPizza / arduino-STM32L4

69 stars 60 forks source link

How to use Serial1 or Serial2 on STM32 L476RG board using GrumpyOldPizza arduino-STM32L4 core #25

Closed mayukhIITD closed 6 years ago

mayukhIITD commented 6 years ago

Hi,

I need to use NEO- 6M GPS with my STM32 L476RG. I tried to use TinyGPS++.h but it requires SoftwareSerial.h which does not work on 80 MHz boards. Hence I have to use Serial1 as mentioned in: http://stm32duino.com/viewtopic.php?t=1959 But the problem is the code that is posted in the above link works for STM32DUINO core (https://github.com/stm32duino/Arduino_Core_STM32) but not on the GrumpyOldPizza core. In GrumpyOldPizza core, Serial1 does not work. Please help me out @GrumpyOldPizza and let me know how to make Serial1 work on GrumpyOldPizza core??

Thanks, Mayukh, IIT Delhi, India

kriswiner commented 6 years ago

Why doesn't Serial1 work, it works for me using an STM32L476RE and this core? Maybe you need to adjust the variant file for your board; it might not use the same pins for Serial1 as this https://www.tindie.com/products/TleraCorp/dragonfly-stm32l47696-development-board/ one.

On Sun, Dec 10, 2017 at 6:00 AM, mayukhIITD notifications@github.com wrote:

Hi,

I need to use NEO- 6M GPS with my STM32 L476RG. I tried to use TinyGPS++.h but it requires SoftwareSerial.h which does not work on 80 MHz boards. Hence I have to use Serial1 as mentioned in: http://stm32duino.com/viewtopic.php?t=1959 But the problem is the code that is posted in the above link works for STM32DUINO core (https://github.com/stm32duino/Arduino_Core_STM32) but not on the GrumpyOldPizza core. In GrumpyOldPizza core, Serial1 does not work. Please help me out and let me know how to make Serial1 work on GrumpyOldPizza core??

Thanks, Mayukh, IIT Delhi, India

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/25, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qvm8Ty1o5Y0lGSIeOfv71hZqwdp4ks5s--PmgaJpZM4Q8gGZ .

GrumpyOldPizza commented 6 years ago

The STM32L476RG NUCLEO board only support "Serial" on D0/D1. That is what the Arduino UNO standard that the Nucleo follows requires, that's what we support on this board.

What does not work with "SoftwareSerial.h" ? I have never tested that, but it implies it's purely some GPIO bitbanging.

N.b. that all of our boards (https://www.tindie.com/stores/TleraCorp/) support tons of UARTs, as we created proper pinmaps that would allow to do so.

On Sun, Dec 10, 2017 at 7:00 AM, mayukhIITD notifications@github.com wrote:

Hi,

I need to use NEO- 6M GPS with my STM32 L476RG. I tried to use TinyGPS++.h but it requires SoftwareSerial.h which does not work on 80 MHz boards. Hence I have to use Serial1 as mentioned in: http://stm32duino.com/viewtopic.php?t=1959 But the problem is the code that is posted in the above link works for STM32DUINO core (https://github.com/stm32duino/Arduino_Core_STM32) but not on the GrumpyOldPizza core. In GrumpyOldPizza core, Serial1 does not work. Please help me out and let me know how to make Serial1 work on GrumpyOldPizza core??

Thanks, Mayukh, IIT Delhi, India

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/25, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfB_LyXYmGcUX0tIahww8QARrEzTdks5s--PmgaJpZM4Q8gGZ .

mayukhIITD commented 6 years ago

@kriswiner : Thank you so much for your hint !! I had to change the variant files corresponding to STM32L476RG and it worked.. @GrumpyOldPizza : The "SoftwareSerial.h" shows the error: "This version of SoftwareSerial supports only 20, 16 and 8MHz processors" when I run it on l476RG board...Anyway now I don't need SoftwareSerial, because I can use Serial1 by modifiying the variant files..

Thanks a lot to both of you for your replies.. :)

GrumpyOldPizza commented 6 years ago

Kris, should we include a ported version of "SoftwareSerial" ? Looks like it's just a problem with some delay clocks ... AVR specific ... Not sure about the value there.

Mayukh, I would recommend against adding Serial1 ... The NUCLEO is really a bad platform for low-power.

On Mon, Dec 11, 2017 at 8:51 AM, mayukhIITD notifications@github.com wrote:

@kriswiner https://github.com/kriswiner : Thank you so much for your hint !! I had to change the variant files corresponding to STM32L476RG and it worked.. @GrumpyOldPizza https://github.com/grumpyoldpizza : The "SoftwareSerial.h" shows the error: This version of SoftwareSerial supports only 20, 16 and 8MHz processors when I run it on l476RG board...Anyway now I don't need SoftwareSerial, because I can use Serial1 by modifiying the variant files..

Thanks to both of you for your replies..

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/25#issuecomment-350764904, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfPYUYFLwHO2jJh6WVlL9sdcHbgsnks5s_U9xgaJpZM4Q8gGZ .

mayukhIITD commented 6 years ago

Thomas, can you please elaborate why you are recommending against adding Serial1 ? Sorry for this, I am very new to this area. In that case what will be the alternate solution for using GPS on my Nucleo L476RG board?

Thanks, Mayukh

GrumpyOldPizza commented 6 years ago

The NUCLEO board is speced with one serial on D0/D1. This is the level that will be maintained. Any changes you make are not supported.

On Mon, Dec 11, 2017 at 9:26 AM, mayukhIITD notifications@github.com wrote:

Thomas, can you please elaborate why you are recommending against adding Serial1 ? Sorry for this, I am very new to this area. In that case what will be the alternate solution for using GPS on my Nucleo L476RG board?

Thanks, Mayukh

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/25#issuecomment-350776516, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfBQ-NikHCeHnHVFa0th0D6f8rDS7ks5s_VfPgaJpZM4Q8gGZ .

mayukhIITD commented 6 years ago

In that case, to add NEO- 6M GPS only SoftwareSerial is what we can rely on?

Thanks, Mayukh

GrumpyOldPizza commented 6 years ago

Connect the NEO-6M to D0/D1.

Please also check the official documentation, UM1724, Table 23. That is what is supported. I do see only one USART2 there, which is mapped to "Serial".

On Mon, Dec 11, 2017 at 9:38 AM, mayukhIITD notifications@github.com wrote:

In that case, to add NEO- 6M GPS only SoftwareSerial is what we can rely on?

Thanks, Mayukh

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/25#issuecomment-350780081, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfJS8fMITV_x9dnLLaT64rvmRtP5pks5s_VpygaJpZM4Q8gGZ .