Skip to main content

Posts

An Ada Client & Server on the STM32WB55

Ada WB55 Client & Server Following on from the last blog posting, I now have a client and server implementation in Ada. Mine is not quite as fancy as ST's, ST's allows role reversal where the client can run on the larger board (MB1355C) and the server on the USB dongle (MB1293C). I only support server on MB1355C and client on MB1293C. Getting the code & building You will need gnat2018 or gnat2019 from AdaCore: https://www.adacore.com/download Once that's installed, you will need some library code and the STM32 dir I use: git clone https://github.com/morbos/Ada_Drivers_Library.git git clone https://github.com/morbos/embedded-runtimes.git git clone https://github.com/morbos/STM32.git mv ../embedded-runtimes Ada_Drivers_Library cd STM32/WB/WB55/cli_serv_wb55 make Once make finishes you get 2 ELF32 files in the obj/Debug dir. admin@ubuntu_1604:/tmp/STM32/WB/WB55/cli_serv_wb55$ make rm -f obj/Debug/client_wb55x (export LOADER=ROM_WB55x; gprb...

Ada on the STM32WB

STM32WB This is a new part family that merges an L series microcontroller with the BlueNRG-MS controller realized now as a single die. The microcontroller can run at 64Mhz has 1MB of flash and 256KB of ram. The wireless portion (I say wireless since its not limited to BT/BLE but also supports Thread and Zigbee), runs on a Cortex-M0+ controller and shares the top of the 1MB of flash for its (encrypted) FW. The M0's FW size seems about 256KB or so. The CM4F and CM0+ communicate by using some of the 256KB of ram as a mailbox. This is supported by HW (IPCC) that signals interrupts from one side to the other when data is ready. In the past, as on the SensorTile, the BlueNRG-MS was connected by SPI and that was the transport, now its done by mailbox and hw signalling. Ada Can we do it again? Can we get Ada running usefully on an WB series part with the added burden of the new control over BT/BLE? I will save the readers time here to say, yes, its possible! further, its working. He...

Shift on Mips-X

Mips-X Mips-X as described earlier on the blog was a Stanford University grad project. A 32bit RISC CPU with some unique features for one, it had 2 delay slots for control change instructions, branches and jumps. I am not aware of any other processor that has that. We had a visit from John Hennessy (Stanford Mips project faculty lead and ultimately university president) one day (not Mips-X related) and I asked him, "why two delay slots?" his paraphrased answer was "It was a graduate project, we were just trying things out". The Shifter Mips-X had a barrel shifter and exposed it to the programmer via these opcodes: asr    rSRC,rDST,#1..32 rotlb  rSRC1,rSRC2,rDST rotlcb rSRC1,rSRC2,rDST sh     rSRC1,rSRC2,rDST,#1..32 Via a combination of the above, all the needed shift operations could be done. Observe though there is no variable shift , just fixed # shift values. My Shift function Now here is a good puzzle for the reader to parse my varia...

Ada on the ST SensorTile

So my MakeWithAda project is now completed. Here is a video of it: https://youtu.be/E290oAYr0f8 Here is the writeup: https://drive.google.com/open?id=1qYsiKS6nfn8r9OeyOpDvv2cfvY0PysvB Here is the code: https://github.com/morbos/STM32/tree/master/L/L476/sensortile Hackster.io project submission: https://www.hackster.io/hedley-rainnie/ada-sensortile-ed44ed

California fires + Air Quality + Ada + Bluepill + PMS7003

Camp fire The Camp fire has had a big effect on the Air Quality Index (AQI) in the Bay Area over the past week or so. AQI is typically measured as an entry in one of 7 bands: https://en.wikipedia.org/wiki/Air_quality_index To compute the AQI (typically cited from the PM2.5 #) a formula is used. See the wiki page above. The PM2.5# is in  µg/m 3  fortunately there is a Chinese sensor, the PMS7003 that can provide PM1, PM2.5 and PM10 in those units: https://botland.com.pl/index.php?controller=attachment&id_attachment=2182 So we have a sensor, we already have a Bluepill running Ada with an SPI screen to display the results.  The sensor is a $20 eBay purchase. Bluepills are < $2 as documented on this blog, screen is a little over $3. So for $25 or so you can build your own AQI meter. Code is in:  https://github.com/morbos/STM32/tree/master/F/F103/aqi3

Bluepill+: Diagnosing bad solder joints

If your like me... a FW engineer attempting to do soldering then this might sound familiar. I have been replacing Bluepill STM32F103C8's with STM32L443CC chips. Its a hack as I do it as I use hot air for the remove and then residual pad solder for the stick down of the replacement. Not surprisingly, some pads don't get good adhesion. Worse, some pads don't show this lack of adhesion until much later when you need the pad to do something useful. The STM32 series are quite good, I think all user pads can be made into GPIOs. What if we wrote a program that toggled each pad every second and then walked the pins with a meter. So that program was written. https://github.com/morbos/STM32/blob/master/L/L443/pinny/src/pinny.adb That's great! Take a look at that code for the abstraction on the GPIOs that the Ada Device Library provides with type GPIO_Points is array (Positive range <>) of GPIO_Point; The magic decl in pinny is: BP_Points : GPIO_Poin...

Tracing a Bluepill

Did you know the lowly STM32F103C8 has non-invasive trace logic along for the ride? Did you also know that via program control: 1) Trace can be enabled out to a pin on the board (PB3). 2) 32 channels can be used to emit 32, 16 or 8bit (char) values from running code. Useful to monitor values from your code. 3) A cycle count can be emitted 4) Data Watchpoints can also be reported. See a picture below. Showing SysTick exception handling: Showing a sensor range value being emitted on channel 16 (that's the max 1FFE in mm's btw) Showing a watchpoint on the read modify write of the Green LED on PC13 (HW watchpoint on: BSRR @0x40011010). Also an Overflow is seen (first time I have seen that actually). Can be mitigated by bumping the output rate. Bluepill shown with a VL53L10X range sensor. The trace is the yellow wire connected to TRACESWO PB3 and green wire is connected to GPIO1 from the sensor. That is plumbed up to go low when a new sample is re...