Lightweight SPI Flash Driver Library: Little_flash

Lightweight SPI Flash Driver Library: Little_flash

Little_flash—— is the SPI Flash driver library for LuatOS, which mounts SPI Flash as an lfs file system, supports NAND/NOR Flash, and provides a unified API to simplify device storage expansion and driver development.

This article will take theAir780EHM core board as an example to share an application example of Little_flash.

Using the Air780EHM core board, the SPI Flash module is mounted as an lfs file system, and files in the lfs file system can be manipulated through file system-related interfaces to achieve reading, writing, deleting, and appending files.

This example is also applicable to the Air780EHV and Air780EGH series products.

1

Main Preparations

  • Air780EHM core board kit

  • SPI Flash module (this article uses W25Q32)

  • Type-C USB data cable

  • PC with Windows 10 or above

Lightweight SPI Flash Driver Library: Little_flash

Lightweight SPI Flash Driver Library: Little_flash

The Air780EHM core board is powered through the Type-C USB port (please switch the switch next to the USB to the ‘on’ position when in use); connect to the SPI Flash module using Dupont wires.

The corresponding pin connection method is shown in the table below:

Lightweight SPI Flash Driver Library: Little_flash

2

Latest Source Code Download

The latest demo has been uploaded to the source code repository:

https://gitee.com/openLuat/LuatOS/tree/master/module/Air780EHM_Air780EHV_Air780EGH/demo/little_flash

Part of the code for little_flash.lua is shown in the figure below; for the complete demo, please refer to the source code repository.

Lightweight SPI Flash Driver Library: Little_flash

3

Example Run Results

The Air780EHM core board burns the kernel firmware and demo script code through LuaTools. After successful burning, it automatically boots and runs.

From the logs, it can be seen that the lfs file system is mounted successfully, and operations such as reading, appending, and deleting files in the lfs file system can be performed normally.

Lightweight SPI Flash Driver Library: Little_flash

Lightweight SPI Flash Driver Library: Little_flash

That’s all for today’s content~ If you have any questions regarding IoT development selection, feel free to join the technical exchange group or contact the person in charge for discussion.

For more of the latest development materials, please refer to the Hezhuo data center:

—— docs.openluat.com

Lightweight SPI Flash Driver Library: Little_flash

▼ Learn More About Hezhuo ▼

4G+ positioning + WiFi + Bluetooth, Air8000 complete development boardNew products: Air8101 core board + accessory board

Hezhuo low-power 4G modules, adding 4 more hardcore new products

Lightweight SPI Flash Driver Library: Little_flash

Leave a Comment