Search This Blog

Radio Guy Tees

Radio Guy Tees
Radio Guy T-Shirts
Showing posts with label STM32. Show all posts
Showing posts with label STM32. Show all posts

Friday, 15 August 2025

Can you still beat the Cube?

Well,

In a feable attempt to prove that I can still write some code, I've been writing software to program the ADF4351 from last time using the STM32CubeIDE and a Nucleo board. The Nucleo boards are really neat because they are from the manufacturer so there is no risk of counterfeit devices, and they are also really low cost for the component count - they even include an on-board STLink programmer (which containst an MCU itself). Amazing really.

The first part of the development is to define the additional GPIO pins needed, in this case we need a CS line (for chip select - only really needed if we have more than one device), and the LE pin which is toggled after each registers data is sent.


Once thats done, I've defined a few variable to help me on my way:


Then we have the main routines:


And finally the output of the SPI pins viewed through a logic analyser:


This is exactly as required.

STM32 provide the HAL (Hardware Abstraction Layer) library to give access to the MCU periferals and also the CMSIS library to access the internal CPU (which is an ARM Cortex from a 3rd party).

Using the Nucleo boards is very easy with STMCubeIDE, but can also now be programmed with the Arduino board manager addon for STM32.

I will now try and generate the same output using the Arduino IDE and see how I fare.

Interesting, don't you think?






Wednesday, 13 August 2025

It's Pill Time again

 You may recall that I used the SDM32 MCU range quite a lot and also the "Blue Pill" board for a lot of my projects.

Recently the board support package that I was using in Arduino has become depreciated and I wanted to document how I now use the boards with the Arduino IDE.

Firstly, in board manager I have added this to the "additional URL's" section:

https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

This is the official board support file from the manufacturer.

Once that is complete, then you also need to install the STMCubeProgrammer, also from the manufacturer.

Once done, there are a number of options to upload from the IDE to the board, most require messing about with the boot jumpers, but there is a HID bootloader we can instal on the board for permanent conenctivity between the IDE and the board. Note the boot jumper settings below:


We then use the STMCubeProgrammer application to connect to the board using the FTDI COM port.


We can then download the appropriate binary from the selection here.

It's critical that you get the correct binary bootloader uploaded, I used the medium density PC13 for my board (PC13 is the pin the onboard LED connection).


Once loading is complete, move the boot jumper back BEFORE removing power, then bob is indeed your uncle.

Inside the IDE, I then used the following settings:


One of my boards didn't work using this method and I strongly suspect a counterfiet device - beware!



Wednesday, 14 October 2020

Its Funny What you can Find

 Well,

Can anyone offer a translation?

Thanks for the credit in the description :-)

Sunday, 10 May 2020

An experimental STM32 Frequency Counter

Well,

In an attempt to learn more about microcontroller programming I have done a little bit of training during this Covid-19 lockdown:



My first real attempt to use these skills is below. I've used a GPS 1pps signal to accurately count an external frequency. This is a GPS disciplined freuqnecy counter:


Good, isn't it?

Here is a picture of me (with Covid-19 dog clipper hair cut) and my beloved Bonnie dog:


Saturday, 18 April 2020

A CW & WSPR Beacon

Well,

I've been fiddling some more with STM32 and have created a DDS based CW & WSPR beacon for 6M.

You can find the details of the project here:


The WSPR code is stolen from Anthony F4GOH, his code and other bits and bobs are on GitHub here:

https://github.com/f4goh/wspr

To counter any drift in the DDS, I've modified my AD9850 board to use an external signal for the clock and configured my Leo Bodnar GPS referenced oscilator to give me 10MHz from output 1 and 125MHz from output 2, thus:


The 125MHz is now used to drive the DDS. I'd be delighted to receive reports from the beacon, the CW signal is on 50.030 and every multiple of 10 mins it sends a 2 min WSPR transmission on 50.293 + 30Hz.

Here's the WSPR beacon RX from G0ORC:


No drift - not even a wobble! Excellent.

Fun, dont you think?

Wednesday, 25 March 2020

An Arduino based Power Meter

Well,

I've been fiddling some more since the Linear we built a little while ago here.

Some musings below on power meters, directional couplers and measuing RF power:



I hope you are all keeping safe - its very scary out there.

Wednesday, 11 March 2020

TFTs and Blue Pills - Are you sure?

Well,

I've been using the STM32 processor (STM32F103 for those playing along at home) based "Blue Pill" board. This board is compatible with the Arduino IDE and I have been using it with the ILI9341 super duper TFT display module.

This is the board in question:



The STM32 board support can be added easily to the Arduino IDE, just add this line:

https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json

to the preferences screen:


Once you have done that you can then install the STM32 cores from the board manager:


I wrote some very simple code to generate Pi using floating point maths:


Set to calculate 100,000 itterations, the good old Arduino Nano ran this code in 29.60099983215332031250 seconds. This Blue Pill board runs the same calculation in 3.07200002670288085937 seconds. Cooking!

Here' how I have wired the test up for the TFT:


I have used the library called "TFT_eSPI" which is here. In the more modern Arduino IDE you just search for it and install from the library manager.

Once you have done that you need to make a couple of edits to the "User_Setup" file which you can find in the libray directory.

Here's mod 1:


and this is mod 2 - please use pins of your choice here:


Once you have done that all should be well!

Please note that this library and config only works with the Arduino STM32 cores and the HID bootloader.....

Friday, 14 February 2020

Making a 10W "QRP" ish linear

I've started to design some software that will control a low power linear amplifier.

I plan to use the 10W Amp from QRPLabs as the main component - I can't make one for the price they sell these kits, so thats on order.

In the meantime, I've been designing some software to control the output switching, and calculate the forward and reflected power and SWR:



Initial software design is included for the STM32 "blue pill" baord.

The software can be downloaded here.

The pinoput for the STM32 board is here.

The schematic for the RF sence using AD8307 is here.

You can purchase a STM32 board here.

The TFT display with touchscreen functionality is here:

More to follow on this topic.

Here's part 2 where I look at the Low Pass Filters and the Log Amps to take accurate power readings in software:





The finsl control software is here.

The simple software based sequencer software is here.

The schematic for the transistor switches I used in the sequencer is here.

The wiring layout for the STM32 is here.

The AD8307 schematic is here.

Sunday, 2 February 2020

A STM32 Processor - really?

Well,

In my never ending desire to fiddle with Microprocessors and/or Micro controllers, I found these boards on my local Amazon with prime next day delivery:


They are called a "Blue Pill" for some reason?!?!? The boards I ordered are these. At the time of writing I could buy 5 of these boards for £15 GBP delivered.

You can use them directly with an external USB -> Serial converter, but you can also upload a bootloader and make the on-board USB port work successfully.

I followed the instructions here:


the speed of these processors is excellent and when used in conjunction with the ILI9342 displays I have been using recently they work very well indeed.

You can see an example of the processor in action in my latest musings on the BITX:


All very impressive and I still fail to believe how inexpensive these MCUs are.

** UPDATE **

There is an alternative bootloader (its much smaller) available for this board now, you can find instructions for using it below. This uses the HID method for uploading: