Posts

Showing posts from April, 2021

Longan Nano, gcc, gdb, Arduino, FreeRTOS

Image
  The more i look at the longan nano (GD32FV103 based), the more i like it. I've played in the past with other Gigadevice chips, in particular the GD32F303 and i liked them a lot. Our goal is to have something similar to the Cmake build + Roger Clark STM32Duino we were using so far : Cmake based, ~ Arduino compatible, much more powerful with DMA support & all. So let's look deeper.  What is the LongNano ? In short, it's  a chinese bluepill based on a riscv32 chip the GD32FV103. It is a very complete chip/board even more so than the bluepill . It has 128 kB of flash, 32 kB of sram and runs at 108 Mhz. The longan nano board comes with a small 160x80 spi color LCD (optional) and a sdcard reader Connectivity difference with bluepill The usb connector is usb type C. I'm pretty sure it's internally usb2.0 with just the type C connector. On one end of the board, there are 8 pins : debug interface (jtag) + serial port 0 In order to debug, you'll absolutely need a us...

Fixing a blurry webcam

Image
 I recently bought a cheap 1080p "autofocus" webcam on  amazon It is definitively not autofocus, despise the claim. Worse the focal is not tuned correctly. The description has changed since. The front panel is just clipped, pop it The focus ring is just glued to in place. The glue is marked in red below. There is a spot of glue on both sides. Remove the glue and the ring will turn. You can now tune the focal distance and have  a crisp image (still fixed focal)

Using platform io debugger with GD32FV103

Image
I'm starting to play with the GD32FV103 chip It is basically a STM32F103 clone with a riscV core instead of an arm M0+ one I've used GD32 chips in the past, and they work pretty well. The overall software support for the GD32FV103/Longan nano is not bad at all, there is a gcc toolchain, a fork of openOCD and even a blackmagic equivalent for it. What about debugging ? Sure thing there is a working command line gdb. Sometimes it is helpful to have a nice UI to debug stuff. Let's give it a whirl : codium/vscode : Does not like  the riscv architecture netbeans : Does not seem to like the very long register list and goes into error quickly platform io : Works ! Platform IO is pretty good when you want an integrated environment with a one click deploy/install. You can compile a "hello world" in 10 seconds. The thing is, i  dont like much all integrated environment. I much prefer a cmake build system with an IDE on top of it. It gives you all the benefits of both. You ca...

Spot welder Control Board : Demo Video / pulse width

Image
 Small   youtube video  of the replacement control board. There's a tiny bug where the rotary encoder button sometimes stops working, apart from that it works  really fine. It is safer than the original one thanks to the LEDs/behaviour of the unit : The state by default is "Off" and the unit can be safely manipulated. When it  is armed , the green LED is On. You can switch between Off and Armed easily. The red light is a good indicator of a blown mosfet. If the red LED is on without contact => mostfets are blown. Similarily if the LED does not get lit when contact is made there is an issue. How do we simply do a pulse of the right duration  ? We program the PWM to have a total period of 100 ms and set the duty ratio to the pulse duration. 5 ms becomes 5% duty ratio. We then stop the PWM after 75 ms. Since we have 25 ms to stop it, so it's not an issue to gurarantee it will be stopped in time. That enables us to have accurate, hardware driven pulse w...

Spot Welder Control board

Image
 First tests are ok, a couple of pictures of the replacement control board for the cheap spot welder The board just plugs in the original power part of the spot welder. The casing is a temporary one for testing purpose. The project on   GitHub