PORTING.md 1.1 KB

Porting guide

Small guide that explaining aspects of code that you need to change.

Defines

T250MS - 250 ms timeout. calculates by (0.25 * SMCLK) / (8 * PSCL)*
T100MS - 250 ms timeout. calculates by (0.1 * SMCLK) / (8 * PSCL)*
Where SMCLK is the frequency of the main oscillator, PSCL is a prescaler that divides frequency for SPI.

CSDIR - register of CS pin port directions**
CSOUT - register of CS pin port output state**
CSPIN - CS pin bit**

*defined in diskio.c
**important only for ports within the MSP430 family

Functions

void spi_init(void) function that initializes SPI and ports.

SPI requirements:

  • 3-wire (without automatic CS)
  • mode 0 (rising edge, LOW base state)
  • MSB mode, 8-bit
  • synchronous mode

void spi_select(void) Function that enabling CS (active state - LOW).

void spi_deselect(void) Function that disabling CS (active state - LOW).

BYTE spi_send(BYTE byte) Function that sending one byte via SPI.

BYTE spi_receive(void) Function that receiving one byte via SPI.

General

Also checkout pff.h and setup correct integer types.