Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Old Betafpv F405 V1.3: third UART or how did I get RX6 for UART6
#1
Star 
Back in 2020, inspired by Umma95's build, I bought this Betafpv F405 V1.3 FC + ESC 2-4S 16A set. This week, I finally decided to build a drone. I know, I'm not fast lol Big Grin
Betaflight identifies it as "AIRB/OMNIBUSF4SD(STM32F405), version: 0"
[Image: UUXeIjLl.png]
It seems like it has three UARTs:
[Image: 4JBIVFnl.png]
But unfortunately, I couldn't find the RX6 pad on the board; there was only TX6. I really needed RX6 for GPS because I reserved UART1 and UART3 for CRSF and Vista.
In the resources, I found that RX6 is mapped to pin C07:
Code:
resource LED_STRIP 1 B06
resource SERIAL_TX 1 A09
resource SERIAL_TX 3 B10
resource SERIAL_TX 6 C06        <------------
resource SERIAL_RX 1 A10
resource SERIAL_RX 3 B11
resource SERIAL_RX 6 C07        <------------
I looked up the CPU datasheet for the pin location and then found out that the pin seemingly wasn't connected to anything.
So, I soldered a thin wire to C07 and connected the GPS module's TX to it:
[Image: PP4uBKil.jpg]
(I really don't need TX6 because I configured the GPS module manually, so I don't really need Betaflight to mess with it; I just want it to read the GNSS data stream.)

And it works well, even on 57600 bps! The CPU load didn't increase, so I guess it's not any kind of emulated serial UART.

But before I came to the solution described above, I had several failed attempts:

1) The most obvious idea was to free the resource for TX6 and use the already connected pin C06 as RX6:
   
Code:
resource SERIAL_TX 6 none
resource SERIAL_RX 6 C06

It didn't work. Why?

2) I found out that pin B12 seemingly was intended for an SD card that I don't use, and it was connected to a convenient pad near the flash chip. So I freed B12 and mapped RX6 to it:

Code:
resource SERIAL_RX 6 B12

But this also didn't work. Why?

3) Then I read Oscar's "The Missing UART6" and tried all of the above with Serial UART: enabled it in the configuration, and tried to map SERIAL_RX 11 to C06 and then to B12. That also didn't work.

For each of the attempts above, I used a GPS configured to 9600 bps with a slow update rate of 500ms and set the speed manually in "Ports" to exclude any speed-related issues. And none of this helped. At the same time, the module worked well with UART1 or UART3.

So yeah, I figured it out, but it was a lot of work, and I'm still confused about how resource mapping works (to me it simply don't).

I hope the first part will help someone out there.
[-] The following 1 user Likes mnn's post:
  • Lemonyleprosy
Reply
Login to remove this ad | Register Here
#2
SERIAL_RX 11, "11" indicates soft serial or software serial. Not something you want to use for GPS. If you want to use softserial for UART6 TX and RX, I suggest you assign it B03 and B10 as Oscar indicated.

What you are trying to do is assign B12 as hardware UART. I believe with hardware UART, you also need to make sure there is a free TIMER and DMA assigned to B12. I am a little rusty, when it comes to this stuff now. Maybe someone else can correct me.
[-] The following 2 users Like voodoo614's post:
  • mnn, Lemonyleprosy
Reply
#3
So I was correct, no TIMER assignment for B12
Code:
#define TIMER_PIN_MAPPING \
   TIMER_PIN_MAP( 0, PB14, 3, -1) \
   TIMER_PIN_MAP( 1, PB15, 3, -1) \
   TIMER_PIN_MAP( 2, PC6 , 2,  0) \
   TIMER_PIN_MAP( 3, PC7 , 2,  0) \
   TIMER_PIN_MAP( 4, PC8 , 2,  0) \
   TIMER_PIN_MAP( 5, PC9 , 2,  0) \
   TIMER_PIN_MAP( 6, PB0 , 2,  0) \
   TIMER_PIN_MAP( 7, PB1 , 2,  0) \
   TIMER_PIN_MAP( 8, PA3 , 1,  1) \
   TIMER_PIN_MAP( 9, PA2 , 1,  0) \
   TIMER_PIN_MAP(10, PA1 , 2,  0) \
   TIMER_PIN_MAP(11, PA8 , 1,  0) \
   TIMER_PIN_MAP(12, PA9 , 1,  0) \
   TIMER_PIN_MAP(13, PA10, 1,  0)
[-] The following 1 user Likes voodoo614's post:
  • mnn
Reply
#4
As for why C06 assigned to UART6 RX didn't work? C06 is an UART TX on the STM32405 MCU. So you cannot reassign it. In general, you can't reassign hardware UART to a different UART. But you can however free UART for other purposes.
Reply
#5
voodoo614, thank you so much for your input! It made everything a bit clearer.
(10-Apr-2023, 04:27 AM)voodoo614 Wrote: SERIAL_RX 11, "11" indicates soft serial or software serial. Not something you want to use for GPS.
Hmm.. I understand that hardware uart is always better, but I thought it was Oscar who said that it's okay for GPS...
Yep, here, although maybe it's outdated.

Here's the hardware UARTs pinout for STM32F405 according to STM32 Cube IDE:
[Image: QODBlYKl.png]
So yeah, it explains why I couldn't swap C6/C7 functions.

But it's still not clear to me why software serial didn't work with B12. Looks like it's a reassignable GPIO pin, and at a slow speed like 9600 bps, there shouldn't be any issues...
Reply
#6
Softserial can be fickle. So Only certain pin works. Usually extra motor outputs, PPM and LED_STRIP are common pins that usually works for softserial. These pin have Timer assigned to them. Unfortunately B12 does not. Probably the reason it doesn't work.
[-] The following 1 user Likes voodoo614's post:
  • mnn
Reply
#7
Sounds like the hours I wasted trying to get T1 pad working on Succex-D AIO. Just wont work. Had to do similar - micro solder to the leg.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  SpeedyBee F405 V3 Testing Motors (Not Spinning) angent56 18 1,904 06-Apr-2024, 03:58 AM
Last Post: angent56
  Help Problem accessing the ESP8285 chip on MATEK FC F405 WTE remi.auge 2 221 05-Mar-2024, 12:49 PM
Last Post: remi.auge
  f405 v3 - tvs diode sonic 1 153 31-Jan-2024, 08:49 AM
Last Post: sonic
  Discussion Speedybee F405 wing Griffin Ucos 2 350 31-Dec-2023, 08:37 AM
Last Post: Griffin Ucos
  SpeedyBee F405 power and UART Q husafreak 9 715 22-Dec-2023, 05:48 PM
Last Post: husafreak


Login to remove this ad | Register Here