Mav to Msp STM32F042

If you made your own board, post here, unless you built a Maple or Maple mini clone etc
Post Reply
UKmook
Posts: 4
Joined: Sun May 17, 2020 9:34 am

Mav to Msp STM32F042

Post by UKmook »

Hi all, i'm new to the forum was unsure if i should post here or new members section, but as its a little board that i made for an existing arduino project i thought i should post here. I make these at home with a small toaster oven, stencils etc and a cheap microscope, but they come out well.
The board is based on STM32F042G6, I wanted a cheap cpu with 32k so this is what i chose, at 4x4mm it fits perfectly. The board converts mavlink protocol to MSP, which then allows an osd to work on a set of DJI FPV goggles, I didn't write the code https://github.com/d3ngit/djihdfpv_mavlink_to_msp_V2 unfortunately for me i try but can never get my head around writing, but i'm pretty good at making boards. I love playing with hardware.
This is the board. Image

Its works fine no issues, because of the STM32duino project it has allowed me to use STM processors, so huge thank you for that.
So now i have a couple of technical software questions. I followed the wiki and was able to add the new variant with ease (version 1.8.0) but i couldn't get the serial 2 working when i add these lines to the variant.h file

Code: Select all

// Default pin used for 'Serial2' instance
#define SERIAL_UART_INSTANCE    2
#define PIN_SERIAL2_RX           PA3 //RX2
#define PIN_SERIAL2_TX           PA2 //TX2
But if i add the following line to the arduino sketch then all works as it should, no problem as there is a workaround but thought i would ask if i had done something wrong.

Code: Select all

HardwareSerial Serial2(PA_3, PA_2);
Also with 1.9.0 there is an error with wkup 2 & 7 in PinNamesVar.h, i have looked up the data sheet and everything is correct. If i add pins from a larger CPU then all builds as expected, i didn't have this issue with 1.8.0.

Anyway, my name is Malcolm, and once again, thanks for a great project.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Mav to Msp STM32F042

Post by fpiSTM »

In fact for:

Code: Select all

// Default pin used for 'Serial2' instance
#define SERIAL_UART_INSTANCE    2
#define PIN_SERIAL2_RX           PA3 //RX2
#define PIN_SERIAL2_TX           PA2 //TX2
if you want the serial2 as default instance then it should be:

Code: Select all

// Default pin used for 'Serial2' instance
#define SERIAL_UART_INSTANCE    2
#define PIN_SERIAL_RX           PA3 //RX2
#define PIN_SERIAL_TX           PA2 //TX2
with your definition it's probably not work because you have PIN_SERIAL_TX also defined.

For the SYSWAKUP pins well, PinNamesVar.h is generated automatically and sometimes (like you said) some pins are missing because HAL does not protect for smaller CPU. So simply manually add them even if they are not used.
UKmook
Posts: 4
Joined: Sun May 17, 2020 9:34 am

Re: Mav to Msp STM32F042

Post by UKmook »

Hi thanks for your reply, I understand it now, added the wkup pins. All is working as it should :D
Post Reply

Return to “Custom design boards”