Skip to content

This example will demonstrate how to interface the 25CSM04-EEPROM chip on-board the Curiosity Nano Explorer development board using I2C protocol.

License

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/pic18f56q24-curiosity-nano-explorer-25csm04-eeprom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microchip Technologies Inc.

Interfacing the 25CSM04 EEPROM on the Curiosity Nano Explorer development board using a PIC18F56Q24 Curiosity Nano

This example demonstrates the setup and configuration of the 25CSM04 EEPROM using the PIC18F56Q24 microcontroller. The 25CSM04 is a 4 Mbit Serial Peripheral Interface (SPI) serial EEPROM, designed to provide reliable, high-density non-volatile memory storage. By interfacing the 25CSM04 using the PIC18F56Q24 Curiosity Nano, this example highlights how to efficiently store and retrieve data using SPI communication, making it ideal for applications that require robust data retention and fast access times.

Related Documentation

Software Used

Hardware Used

Curiosity Nano Explorer

Setup

The userguide for the Curiosity Explorer Nano board provides detailed information about the pin mapping between the Curiosity Explorer board and the PIC18F56Q24 Curiosity Nano board being used in this example.

Explorer25CSM04

Based on the diagram above from the Curiosity Explorer users guide, the SPI CS, SPI MOSI, SPI MISO, and SPI SCK lines will be used to communicate with the 25CSM04 SPI EEPROM.

MCC Setup

The detailed step by step instructions required to recreate this example are listed below:

Begin by setting up UART to enable data display on the terminal.

UART Setup

The UART configuration should appear as shown below.

  • With MCC open, add the UART driver and select UART2 in the dependency selector.
  • Ensure that "Redirect Printf to UART" is enabled.
  • The UART configuration should appear as shown below.

UART setup

  • No changes are required for UART2PLIB



SPI Setup

  • Add the SPI driver and select SPI1 as the SPI Host PLIB Selector.
  • Set the requested speed to 4000 kHz and ensure that the SPI interrupt is enabled.
  • The SPI configuration is also shown in the image below.

SPI setup

SPIPlib setup


Pins Setup

  • Select the appropriate UART and SPI pins as indicated in the diagram below.

ExplorerMCP23008

  • The MCC configuration for the pins is shown below.

pins setup

pins1 setup


  • Click on "Generate" to complete the configuration in MCC.
  • Add the 25CSM04.c and 25CSM04.h driver code to the project.
  • Modify main.c as shown in the screenshot below.

screenshot

  • This code snippet calls writeReadByteTest(0x0000), which performs consecutive read and write operations starting from address 0x0000.
  • The code displays the written and read values and verifies whether these values match.

Operation

After programming the device, the terminal displays the output indicating whether the tests have passed or failed.

output

Summary

This demonstration shows how to interface the 25CSM04 SPI EEPROM on the Curiosity Nano Explorer board using a PIC18F56Q24 microcontroller. In this example, several tests are performed to validate the functionality of the EEPROM interface. Data is written to a specific memory location, and then read back from the same address to ensure that both the write and read operations are working correctly. The results of these tests are displayed on the terminal, providing clear feedback on the success or failure of each operation.

About

This example will demonstrate how to interface the 25CSM04-EEPROM chip on-board the Curiosity Nano Explorer development board using I2C protocol.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •