bcm2835 1.75
Functions
SMI bus support

Functions

int bcm2835_smi_begin (void)
 
void bcm2835_smi_end (void)
 
void bcm2835_smi_set_timing (uint32_t smichannel, uint32_t readchannel, uint32_t setupcycles, uint32_t strobecycles, uint32_t holdcycles, uint32_t pacecycles)
 
void bcm2835_smi_write (uint32_t smichannel, uint8_t data, uint32_t address)
 
uint32_t bcm2835_smi_read (uint32_t smichannel, uint32_t address)
 

Detailed Description

Allows access to SMI bus

Function Documentation

◆ bcm2835_smi_begin()

int bcm2835_smi_begin ( void  )

Start SMI operations. Forces RPi SMI pins P1-19 (MOSI), P1-21 (MISO), P1-23 (CLK), P1-24 (CE0) and P1-26 (CE1) to alternate function ALT1, which enables those pins for SMI interface. You should call bcm2835_smi_end() when all SMI functions are complete to return the pins to their default functions. Only address bits SA0 to SA3 are available as RPi uses GPIO0 (SA5) and GPIO1 (SA4) for I2C HAT identification EEPROM access

See also
bcm2835_smi_end()
Returns
1 if successful, 0 otherwise (perhaps because you are not running as root)

◆ bcm2835_smi_end()

void bcm2835_smi_end ( void  )

End SMI operations. SMI pins P1-19 (MOSI), P1-21 (MISO), P1-23 (CLK), P1-24 (CE0) and P1-26 (CE1) are returned to their default INPUT behaviour.

◆ bcm2835_smi_read()

uint32_t bcm2835_smi_read ( uint32_t  smichannel,
uint32_t  address 
)

Reads one byte from SMI bus. Uses polled transfer as described in BCM 2835 ARM Peripherals manual

Parameters
[in]smichannelSMI configuration slot to use (0 to 3)
[in]addressThe address to read from
Returns
value read from SMI bus
See also
bcm2835_smi_readnb()

◆ bcm2835_smi_set_timing()

void bcm2835_smi_set_timing ( uint32_t  smichannel,
uint32_t  readchannel,
uint32_t  setupcycles,
uint32_t  strobecycles,
uint32_t  holdcycles,
uint32_t  pacecycles 
)

Setup SMI bus cycle timing parameters There are four SMI channels for read operation and four channels for write operation Cycles are expressed as multiple of 8ns Note that Pace cycles are not used (no effect on hardware) but they are required for configuration. It is recommended to set this value to 1 (and not 0) to have the smallest cycle in case the hardware would recognize it

Parameters
[in]smichannelSMI configuration slot to setup (0 to 3)
[in]readchannelSet to 1 to configure the read channel (0 = configure write channel)
[in]setupcyclesTime between address assertion on bus and OE/WR signal assertion
[in]strobecyclesDuration of OE/WR signal assertion
[in]holdcyclesTime after OE/WR deassertion before address is deasserted
[in]pacecyclesTime before next SMI bus cycle

◆ bcm2835_smi_write()

void bcm2835_smi_write ( uint32_t  smichannel,
uint8_t  data,
uint32_t  address 
)

Transfers one byte to SMI bus. Uses polled transfer as described in BCM 2835 ARM Peripherals manual

Parameters
[in]timingslotSMI configuration slot to use (0 to 3)
[in]dataThe data byte to write
[in]addressThe address to write to
See also
bcm2835_smi_writenb()