Generate square wave signal with Raspberry Pi Pico PIO

 Author:   Posted on:    No comments

I recently bought a couple of Raspberry Pi Pico microcontroller boards. Although I read about the PIO peripheral, I didn't pay too much attention to it. However, it seems to be an interesting peripheral that I haven't seen before on other microcontrollers. It is supposed to be a versatile I/O interface which will allow you to implement custom serial or parallel protocols in a better way than bitbanging a GPIO pin.

Actually, the PIO is made of two blocks, each containing four state machines. These are individual processing units optimized for I/O, with "a focus on determinism, precise timing, and close integration with fixed-function hardware" as the datasheet claims. Sounds good, doesn't it? This is until you get to program these "machines" in... assembly language. I'm totally new to this, so in this post I will generate a square wave signal using the PIO.

Generate square wave signal with Raspberry Pi Pico PIO

Set up Raspberry Pi Pico for MicroPython

 Author:   Posted on:    2 comments

Raspberry Pi Pico is a newly released microcontroller board from Raspberry Pi Foundation. Since it is quite powerful and versatile, it may prove an excellent alternative to Arduino Nano or STM32 Blue Pill. Having a similar form factor to those two development boards, the Raspberry Pi Pico can be bought for about 4 EUR (5 USD). Keep in mind that this is the price of the original product, from most approved resellers, much lower than an official Arduino Nano or the retired Maple Mini from Leaflabs (the “blue pill” is based on it).

But there is more to it than the lower cost. The microcontroller has a dual core CPU running at a frequency up to 133 MHz with 264 kB of SRAM and 2 MB of flash. With 26 GPIO pins and native USB device and host support, Raspberry Pi Pico seems better than Arduino Nano and STM32 Blue Pill. It is definitely missing the kind of connectivity you get with ESP chips (WiFi and/or bluetooth), that’s why I’m not comparing it to the ESP8266 or ESP32. Even though, it is a good choice for projects that do not require such connectivity. Nevertheless, a LAN or Bluetooth connectivity module may be interfaced to Raspberry Pi Pico when needed.

Set up Raspberry Pi Pico for MicroPython

Dump data from NAND flash with Arduino

 Author:   Posted on:    No comments

A while ago I decided to see if it is possible to read data from a NAND flash memory chip using an Arduino. Although I found out it is possible, it is not quite practical. The ATmega328 Arduino is way too slow to read and transfer large amounts of data. Nevertheless, dumping data is possible. But for common usage, such a slow and limited microcontroller shall not be used for this purpose.

In the previous posts I wired the NAND to a 3.3V Arduino and wrote a basic sketch to communicate with the flash chip and read its ID register. Now I will attempt to read data from the memory and transfer it to PC over serial port. I must say I have no prior experience with NAND memory chips and this is the first time I’m ever attempting this.

Dump data from NAND flash with Arduino

Read NAND Flash device signature with Arduino

 Author:   Posted on:    No comments

NAND Flash chips are widely used non-volatile memory devices. They have high storage capacity, fast access time and are reliable, usually being able to withstand 100,000 erase/program cycles. Such chips are available with parallel or serial interface (commonly SPI). While the latter can be easily interfaced to any SPI port and can be read/programmed even by slow microcontrollers, parallel chips are faster and require more data lines (connections) to host microcontroller.

In the previous post I described the way I connected a NAND flash to Arduino (a Pro mini compatible board running at 3.3 V). This time, I'll deal with the limitation of the small MCU and read the NAND signature.

Read NAND Flash device signature with Arduino

Attempts at reading parallel NAND Flash with Arduino

 Author:   Posted on:    No comments

NAND Flash chips are widely used non-volatile memory devices. They have high storage capacity, fast access time and are reliable, usually being able to withstand 100,000 erase/program cycles. Such chips are available with parallel or serial interface (commonly SPI). While the latter can be easily interfaced to any SPI port and can be read/programmed even by slow microcontrollers, parallel chips are faster and require more data lines (connections) to host microcontroller.

Having an old DSL modem which cannot be flashed with a locked bootloader and unavailable JTAG port I unsoldered its NAND flash. I do not own a parallel memory programmer and I do not intend to buy one for the sole purpose of dumping useless data from this flash. So, I attempted to interface this memory to what I have. At first it seemed it has too many pins to wire it to a common ATmega328p Arduino. But the datasheet revealed something else.

Attempts at reading parallel NAND Flash with Arduino

Bargraph timer, an unusual LM3914 application

 Author:   Posted on:    No comments

LM3914 and LM3915 are dot/bar display drivers used to create basic displays of analog voltage levels. They are widely used in VU-meters and various voltage indicators (for batteries). The LM3914 senses an analog voltage and drives a number of LEDs depending on the level of this voltage. Knowing this, we can provide this voltage from a discharging capacitor. Depending on the resistive load which discharges the capacitor, the time required to turn off all LEDs can be set to specific intervals. This is how a timer is made using LM3914 (or LM3915).

This IC contains a constant current source for LEDs and an adjustable voltage reference. The following circuit uses LM3914 internal current source to charge the capacitor. To be able to modify countdown time, a potentiometer is used to discharge the capacitor. When the last LED is off two opamps drive a relay. The two opamps are part of the LM358 integrated circuit and one of them is used, in a similar manner, with a capacitor that is charged/discharged to provide an optional turn-off time for the relay. By setting a jumper you can choose between relay always on after time is up or relay on for an adjustable amount of time.

LM3914 countdown timer built on PCB

LM3914 countdown timer built on PCB