Lab Assignment (in C): SPI Flash Interface
The objective is to learn how to create a thread-safe driver for Synchronous Serial Port and to communicate with an external SPI Flash device.
This lab will utilize:
- SPI(SSP) driver
- Code interface for the SPI flash
- Basic knowledge of data structures
- Mutex strategy to access the SPI flash safely across multiple tasks (or threads)
- Logic Analyzer capture
Part 0: SPI Driver)
Implement
ssp2.h and
ssp2 status register }
Code Block 1. ssp2.h and ssp2.c
Part 1: SPI Flash Interface
Get the code below to work and validate that you are able to read SPI flash memory's manufacture id and compare with the SPI flash datasheet to ensure that this is correct.
#include "FreeRTOS.h" #include "task.h" #include "ssp2; } // TODO: Read Adesto flash datasheet to read its 'STATUS' register uint8_t adesto_read_status(void) { } void spi_task(void *p) {(); }
Code Block 2. SPI flash interface test.h" void spi_id_verification_task(void *p) { while (1) { const adesto_flash_id_s id = ssp2__adesto_read_signature(); // When we read a manufacturer ID we do not expect, we will kill this task if (id.manufacturer_id != 0x1F) {()function such that two tasks will not be able to run this function at the same time.
- If implemented correctly, you will not see the error printf
Requirements
What to turn in
- Include all the code you developed in this lab
- Turn in the screenshots of terminal output.
- Include Manufacturer ID
- Include bit-by-bit print-out of the Adesto STATUS register
-
Revision #12
Created 1 month ago by Preet Kang
Updated 1 month ago by Preet Kang