smi(3)

πŸ“¦
version 1.75 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu questing

πŸ’– smi(3) β€” SMI bus support πŸ’–

okay bestie, gather round, because we're talking about the smi page from the Library Functions Manual and it's literally all about letting you touch the SMI bus πŸ¦‹ no cap.


✨ NAME ✨

smi β€” SMI bus support


🌸 SYNOPSIS 🌸

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. that's it, that's the whole vibe. short. iconic. πŸ’…


πŸ‘‘ Function Documentation πŸ‘‘

🫢 int bcm2835_smi_begin (void) [extern]

Start SMI operations. this one forces the RPi SMI pins P1-19 (MOSI), P1-21 (MISO), P1-23 (CLK), P1-24 (CE0) and P1-26 (CE1) into alternate function ALT1, which is what enables those pins for the SMI interface. slay. ✨

bestie you should call bcm2835_smi_end() when all your SMI functions are complete, so the pins go back to their default functions. don't leave them hanging fr fr 😭

also, heads up: only address bits SA0 to SA3 are available as RPi uses GPIO0 (SA5) and GPIO1 (SA4) for I2C HAT identification EEPROM access. iykyk.

See also

  • bcm2835_smi_end()

Returns

  • 1 if successful, 0 otherwise (perhaps because you are not running as root) πŸ’€

🌈 void bcm2835_smi_end (void) [extern]

End SMI operations. the 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. clean exit, main character energy πŸ‘‘


⭐ uint32_t bcm2835_smi_read (uint32_t smichannel, uint32_t address) [extern]

Reads one byte from SMI bus. uses polled transfer as described in BCM 2835 ARM Peripherals manual πŸ“–

Parameters

  • smichannel β€” SMI configuration slot to use (0 to 3)
  • address β€” The address to read from

Returns

  • value read from SMI bus πŸ’–

See also

  • bcm2835_smi_readnb()

🧚 void bcm2835_smi_set_timing (uint32_t smichannel, uint32_t readchannel, uint32_t setupcycles, uint32_t strobecycles, uint32_t holdcycles, uint32_t pacecycles) [extern]

Setup SMI bus cycle timing parameters. okay so there are four SMI channels for read operation and four channels for write operation. cycles are expressed as multiple of 8ns ⏱️

not me having to say this: 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. so like… set it, bestie πŸ™ˆ

Parameters

  • smichannel β€” SMI configuration slot to setup (0 to 3)
  • readchannel β€” Set to 1 to configure the read channel (0 = configure write channel)
  • setupcycles β€” Time between address assertion on bus and OE/WR signal assertion
  • strobecycles β€” Duration of OE/WR signal assertion
  • holdcycles β€” Time after OE/WR deassertion before address is deasserted
  • pacecycles β€” Time before next SMI bus cycle

πŸ’œ void bcm2835_smi_write (uint32_t smichannel, uint8_t data, uint32_t address) [extern]

Transfers one byte to SMI bus. uses polled transfer as described in BCM 2835 ARM Peripherals manual πŸ”₯

Parameters

  • timingslot β€” SMI configuration slot to use (0 to 3)
  • data β€” The data byte to write
  • address β€” The address to write to

See also

  • bcm2835_smi_writenb()

πŸ’Œ Author πŸ’Œ

Generated automatically by Doxygen for bcm2835 from the source code. it wrote itself, honestly, we're just here for the vibes πŸŽ€


and that's the whole page, bestie!! this beauty lives in bcm2835, Version 1.75 β€” so if you ever need to cite it, that's the version and that's the source, mwah πŸ’‹ periodt ✨

πŸ“¦ where this page comes from