STM32L082 JeeNode Zero clone USB-ed !!

Added by plutonomore about 2 months ago

                                                          STM32L082 JeeNode Zero Clone, USB Adventures 

I realise that the JeeLabs forum site hasn’t seen much action of late but have been working on losing the

JeeNode Zero FTDI/USART1 serial connection and replacing it with a combination USB CDC Virtual COM Port
(USB\ VID_0483 & PID_5740) and USB DFU Port (USB\ VID_0483 & PID_ DF11) USB ONLY connection. Essentially,
just want to get rid of having to pay the extra cost of a USB to serial adapter, FTDI etc., especially when a USB
device is already incorporated on the uC’s Silicon. It would also mean no more “chicken and egg” stuff! Others
who have an interest in the JeeNode Zero, might find this useful .

Well it turns out, that like so many endeavours of mice and men, things didn’t really end up according to the
original plan. The JeeNode Zero clone uses the STM32L082KZT6 MCU (192Kb FLASH, 20Kb SRAM, 8Kb EEPROM)
instead of the pin compatible JeeNode Zero STM32L052K8T6 MCU (64Kb FLASH, 8Kb SRAM,2Kb EEPROM).
More importantly, the L082 has on chip USB hardware and both USART1 and USB bootloaders installed in
firmware at manufacture. The L082 USB has two functional modes, operating mode for normal communication
and STM DFU mode for the downloading and uploading of FLASH.

Seems pretty straight forward. Come up with a schematic, fig (i), produce a “hand crafted” pcb, fig (ii), (iii), (iv)
... I definitely have masochistic tendencies, write a L082 USB Console driver, fig (v) and a L082 HAL, fig (vi), (vii).
I could NOT have been more wrong!! Mr.Murphy was working overtime on this one but that’s a story for
another time!

OK, wrote and ran the L082 USB Console driver and the HAL code, pretty much following the excellent work of
Jean Claude Wippler (JeeLabs) and Jan Spakula (aka flabbergast, author of the “bat board”). Early in the
piece, contrary to the datasheets, decided to try and get away with no external crystal source to the Phase
Locked Loop (PLL), to drive the USB rather than use the HSI48 (RC48), USB purpose specific USB clock source
... heurism is the ultimate arbitrator and who knows, we might get lucky, it might even work! fig (viii) Opened up
Window’s Device Manager and disconnected the FTDI adapter from the board, COM(9) disappears. Plugged a
USB cable into the pcb micro USB socket, connected the cable to the host PC and miracle, a new COM(15) port
appears, fig (ix). Now let’s check out Folie, as you can see, the USB COM(15) port is enumerated and all the
extra USB dictionary words can be made to magically appear, using the “list” word, fig (x) ... looking good! OK,
let’s do a “hexdump”, so we have a .hex file of the USB modified Mecrisp, in case we screw things up, fig (xi).

When the pcb was completed, I breathed a huge sigh of relief, I thought those LQFP32 packages presented
enough of a challenge to work with but working with that micro USB socket introduced me to a whole new world
of pain ... destroyed two of them and one pcb before success.

I wanted to play with the STMicroelectronics DFU application, which let’s you flash code to the uC via the USB
Port in DFU bootloader mode. We need to download STM’s DfuSe Demo V3.0.6 (en.stsw-stm32080) from their
website. Once installed, create desktop shortcuts for the DfuSeDemo V3.0.6 and DfuFileMgr applications and
you are good to go.

First order of business is to try out the STM DfuSe Demo V3.0.6 application. On running the STM DfuSe Demo
V3.0.6 application, a pretty self explanatory GUI presents itself. To FLASH the STM32L082KZT6 we have to put
the uC in DFU bootloader mode. Jumper pins 2 & 3 of JP1, pulling BOOT0 HIGH and hit the reset button, S1.
In the Window’s Device Manager, STM device in DFU mode magically appears, hiding amongst the Universal
Serial Bus Controllers , fig (xii) and at the same time the STM DfuSeDemo V3.0.6 GUI, fig (xiii), comes to life, filling
in the previously blank GUI data fields. This GUI can be used to both upload and download FLASH ... hey, it actually
works! When using this application, *.hex files need to be converted to a STMicroelectronics *.dfu format. Click
on the DfuFileMgr application desktop shortcut and away you go.

Have to admit that when using Folie as my terminal program, I find the frequency that the USB connection
connects and disconnects, pretty annoying! Also noticed that when using other terminal applications, this
behaviour is absent ... is this peculiar to this Folie Mecrisp USB combination?

Anyway, it’s great to be able to ditch that superfluous FTDI USB to serial adapter and to happily just use a
USB cable only connection.

Am really enjoying exploring the interactive nature of this Mecrisp-Stellaris FORTH, stack based, optimising
native code compiler stuff. This flavour of FORTH certainly seems to lend itself to embedded applications!

If anyone should decide that they might like to try their hand at cobbling together one of these, good luck,
you should find pretty much all the information you need in the schematic. I would certainly appreciate any
feedback . If you have any queries, try contacting me at

Replies (3)

RE: JeeNode Zero clone USB-ed !! - Added by plutonomore about 2 months ago

That's no good, still have three more figs to attach ... here they come.

RE: STM32L082 JeeNode Zero clone USB-ed !! - Added by linuxpeppe about 1 month ago

It's look like a great work. I'm very happy to see another Forth lover since JCW and TVE seems to have abandoned this language. I have been learning Forth starting from embello project two years ago.
I use it in everyday work alternating to C code. But it seems to be a very old language with very poor support and resources.
I found something similar to yout work in flabbergast bat board:
I will contact you by email. Mine is "expo at".


PS: I show you some prototypes, i'm working on, using STM32L0xx programed in Forth interfaced on UART to ESP32 programmed in C.
I have spare PCB that i can send if helpful

RE: STM32L082 JeeNode Zero clone USB-ed !! - Added by plutonomore about 1 month ago

Thought, for the sake of completeness and trying not to push my luck, too much, decided to add this to the previous post.

As I mentioned previously, I decided to try and get away with not using an external crystal for the PLL clock source. I
have tried this approach on TWO chips now, over a period of several days and all seems well but I suppose an argument
can always be made that I just got lucky with those two and the other thirteen chips could be a different story. So, I have
written a revised HAL , fig (xv), fig (xvi) and fig (xvii) which uses the HSI48(RC48) clock as the USB source, which is
acceptable as far as the datasheets are concerned. Also included is the USB console, fig (xviii).

Have also included a clock solution diagram, for the the HSI48(RC48) , fig (xix). Also attached is the new .hex file, fig (xx).

Anyway, if you do decide to play with this toy, please try both .hex files, I’m really curious to see if others find the
HSI48(RC48) configuration mandatory? ... have fun!!