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 Video Library
Refcards
Trend Reports

Events

View Events Video Library

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

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Emulating the History Command Within a Bash Script
  • Git Bash (Or Git in Bash)?
  • SonarQube Analysis With Ginkgo on Mac
  • Automate Sign-In To Any Website Using Selenium Web-Driver

Trending

  • Start Coding With Google Cloud Workstations
  • Why Database Migrations Take Months and How to Speed Them Up
  • The Future of Java and AI: Coding in 2025
  • Immutable Secrets Management: A Zero-Trust Approach to Sensitive Data in Containers
  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.

By 
Erich Styger user avatar
Erich Styger
·
Jan. 08, 19 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
12.7K 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.

Related

  • Emulating the History Command Within a Bash Script
  • Git Bash (Or Git in Bash)?
  • SonarQube Analysis With Ginkgo on Mac
  • Automate Sign-In To Any Website Using Selenium Web-Driver

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: