DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. Languages
  4. Driver and Command Line Shell for Winbond W25Q128 16MByte Serial FLASH Device

Driver and Command Line Shell for Winbond W25Q128 16MByte Serial FLASH Device

Learn more about dealing with FLASH memory on your microcontrollers.

Erich Styger user avatar by
Erich Styger
·
Jan. 08, 19 · Tutorial
Like (3)
Save
Tweet
Share
11.44K Views

Join the DZone community and get the full member experience.

Join For Free

Modern microcontrollers come with plenty of internal FLASH memory. On the other side, many high-performance MCUs, such as the NXP i.MX RT, are ‘flashless’ because the silicon process for high-performance cores is not matching the FLASH memory technology, so they are using external serial SPI or Quad-SPI (QSPI) memory instead.

Winbond w25q128 breakout board

Winbond w25q128 Serial Flash Breakout Board

Why Not Use an External SPI FLASH for a ‘Normal’ Microcontroller, Too?

The typical usage of external SPI flash memory is using it to load or store data. With the addition of a small external device on the SPI bus, I can easily add several MBytes of memory to the microcontroller. Such SPI memory devices are very inexpensive; I ordered a few breakout modules with Winbond W25Q128 (16 MByte) from AliExpress for $1.50 each. The device uses the following pins:

  • VCC: 3.3V
  • GND
  • DO: SPI MISO
  • DI: SPI MOSI
  • CS: SPI Chip Select

A red LED on the breakout module indicates if the board is powered.

Usually, I use micro-SD cards for logging data. They are easily available, provide nearly ‘unlimited’ storage, and, with the FatFS file system, I can easily exchange data with the host. But it needs space on the PCB and the SD card socket needs to be accessible. The socket is a mechanical component and has its costs; plus, it is not very reliable in an environment with vibrations and subject of corrosion. Using a FLASH chip might be the better solution.

I have created a driver with a command line interface: that way, I can read/write data of the SPI FLASH memory device. An Eclipse example project is available on GitHub (check the links at the end of this article).

The example is running on an ARM Cortex-M4 from NXP (Kinetis K20DX128), but it can easily be ported for any other microcontroller.

using w25q128 with k20dx128

using w25q128 with k20dx128

The project includes a command line Shell:

command line shell for serial flash

command line Shell for serial flash


With the Shell, I can read/write the serial flash:

serial flash read and write

serial flash read and write

The ‘status’ command gives information about the device found:

device status

device status

Summary

I have now a working driver for using the Winbond W25Q128 16 MByte serial/SPI flash chip. The driver is still in an early stage, and I might update it to support other Flash devices, too. With the command line interface, I can read/write the memory. In the next step, I plan to use the memory with a file system and include more about this in a future article. The project is available on GitHub (see links below).

Happy Winbonding!

Links

  • Example project on GitHub
  • Winbond W25Q128 Datasheet
  • Serial Flash driver by Paul Stoffregen
  • Winbond driver for STM32
  • W25Q128 breakout module
Command (computing) Driver (software) shell Memory (storage engine) Service provider interface Flash memory

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Automated Performance Testing With ArgoCD and Iter8
  • Spring Cloud: How To Deal With Microservice Configuration (Part 1)
  • Load Balancing Pattern
  • TDD: From Katas to Production Code

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: