Sample SPI drivers for a number of the Adesto Technologies flash devices.
User Configuration

This layer gives the user a one-stop location to customize the driver to their specific MCU and flash device. Through the use of conditional compilation, function calls, and various c-defines the user can specify the GPIO driver used in their project and tie the SPI IO lines to specific ports and pins.

Porting this project to a specific MCU involves declaring the ports and pins connected to the flash device, defining various functions tied to the SPI layer, and declaring the flash device used. This guide is broken into sections addressing each of these steps. Once they have been completed, the Adesto layer should be fully functional.

Ports and Pins

The port and pin numbers used in this project must be defined based on the MCU and board being used. The definitions should be placed in user_config.h. The port and pin information is used when initializing and toggling GPIOs, and these 2 identiffiers should be all that's needed. The port/pins that need defining are as follows:

  1. USER_CONFIG_CSB_PORT
  2. USER_CONFIG_CSB_PIN
  3. USER_CONFIG_TRIGGER_PORT
  4. USER_CONFIG_TRIGGER_PIN
  5. USER_CONFIG_SCK_PORT
  6. USER_CONFIG_SCK_PIN
  7. USER_CONFIG_MOSI_PORT
  8. USER_CONFIG_MOSI_PIN
  9. USER_CONFIG_MISO_PORT
  10. USER_CONFIG_MISO_PIN
  11. USER_CONFIG_IO2_PORT
  12. USER_CONFIG_IO2_PIN
  13. USER_CONFIG_IO3_PORT
  14. USER_CONFIG_IO3_PIN

The port should be an address, while the pin should be the pin number within the port, although the user may implement the functions that use these variables differently. See the following section for details on how these port and pin numbers are used.

SPI User Defined Functions

The user must also define the following functions within the user configuration layer:

  1. USER_CONFIG_BoardInit()
  2. USER_CONFIG_PinInit()
  3. USER_CONFIG_PinClear()
  4. USER_CONFIG_PinSet()
  5. USER_CONFIG_PinRead()

As the names imply, these functions are the hooks to a GPIO driver specific to the MCU being used. The functions must initialize a pin on single port as either an input or an output, and set the level. The documentation for the functions describe their behaviour and should be referenced when redefining them.

Flash Device Selected

While the SPI layer bit-banged driver is built to cover the full range of Adesto SPI flash products, the Adesto layer is meant to be general purpose within a given family. Almost all features are declared/defined. As such, some functionality may not be supported on a device within a certain family. To differentiate between devices in the general Adesto layer, conditional compilation 'locks' and 'unlocks' the opcodes and related functions. Before using the driver a user must specify the flash device being used in user_config.h with PARTNO, a list of which can be seen within the comments of that file. (EX: '#define PARTNO AT45DB041E').

File Links

User Configuration Layer