Summary: In this lab we will program a flash memory driver.
In this lab, you will write your first driver for the MSP430. In the previous lab, datasheets were introduced, but there was only a small amount of information needed from the datasheet. In this lab, you will focus on writing a library of functions to provide access to the Flash memory chip on the processor. This chip, Atmel’s AT45DB161B 2Mbit flash memory (www.atmel.com), interfaces with the MSP via the SPI module. In this lab, the serial interface modules will be covered again. The explanation of the flash memory chip is left largely up to the datasheet, but we will provide you with a list of the important information you will need to find. The lab will explain the programming organization behind writing the memory interface. The lab project itself culminates in a working memory interface with the Atmel chip.
In order to understand how to write a programming interface for the Atmel chip, some explanation of what a software library is might be helpful. Our particular library for the Atmel flash chip is going to be a type of driver. You may also find explanations of serial protocols and data sheet interpretation useful.
The Atmel data sheet outlines the operating conditions and commands of the AT45DB161B. Based on the data sheet, answer the following questions.
Status Register Read command important for implementing any other commands?Buffer Write command (without writing to the flash until later) useful? Why would the Main Memory Page to Buffer Compare be similarly useful?Write the template for your implementation of the following commands in a library for the AT45DB161B. The template should include the input parameters, return value, name of the function, and what the function specifically does to the inputs and outputs. These C functions should aim to be as close to simple executing the command as possible.
Implement the commands from Exercise 2 in C for the ELEC 226 board, adhering to the templates provided from Exercise 2.
Using the commands implemented in Exercise 3, implement the following commands. The templates are provided below. These commands are essentially "read" and "write" that hide the implementation details and behavior that this flash memory requires.
int read_data(char* read_array, int size, int page_address, int byte_address)
parameters:
returns:
int write_data(char* write_array, int size, int page_address, int byte_address)
parameters:
returns: