Difference between revisions of "Unit BCM2708"
(9 intermediate revisions by the same user not shown) | |||
Line 61: | Line 61: | ||
Both devices support 3 chip selects, by default SPI1 is available on GPIO pins 16 to 21 (CS2, CS1, CS0, MISO, MOSI, SCLK) using alternate function 4 and SPI2 is available on GPIO pins 40 to 45 (MISO, MOSI, SCLK, CS0, CS1, CS2) using alternate function 4. Only pins 16 to 21 are available on the header and only on the 40 pin header of the Raspberry Pi A+/B+/Zero/2B/3B. | Both devices support 3 chip selects, by default SPI1 is available on GPIO pins 16 to 21 (CS2, CS1, CS0, MISO, MOSI, SCLK) using alternate function 4 and SPI2 is available on GPIO pins 40 to 45 (MISO, MOSI, SCLK, CS0, CS1, CS2) using alternate function 4. Only pins 16 to 21 are available on the header and only on the 40 pin header of the Raspberry Pi A+/B+/Zero/2B/3B. | ||
+ | |||
+ | '''BCM2708 SPI/I2C Slave Device''' | ||
+ | |||
+ | The slave device can be used as either an I2C or an SPI interface, the I2C slave supports 400KHz fast mode operation. Only 7 bit addressing is supported, DMA is not supported and neither is clock stretching. | ||
+ | |||
+ | Note: On the Raspberry Pi A+/B+/Zero/2B/3B the SPI slave device is apparently faulty and cannot be used. | ||
+ | |||
+ | The I2C Slave device can only appear on GPIO pins 18 (SDA) and 19 (SCL) (Alternate function 3). | ||
'''BCM2708 DMA Device''' | '''BCM2708 DMA Device''' | ||
Line 88: | Line 96: | ||
On the Raspberry Pi A and B only pin 18 is exposed on the 26 pin header. | On the Raspberry Pi A and B only pin 18 is exposed on the 26 pin header. | ||
− | On the Raspberry Pi A+/B+/Zero/2B/3B pins 12, 18 and 19 are exposed on the 40 pin header. | + | On the Raspberry Pi A+/B+/Zero/2B/3B pins 12, 13, 18 and 19 are exposed on the 40 pin header. |
'''BCM2708 GPIO Device''' | '''BCM2708 GPIO Device''' | ||
Line 314: | Line 322: | ||
|- | |- | ||
| <code>BCM2708_I2CSLAVE_DESCRIPTION = 'BCM2835 I2C Slave';</code> | | <code>BCM2708_I2CSLAVE_DESCRIPTION = 'BCM2835 I2C Slave';</code> | ||
− | | | + | | |
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>BCM2708_I2CSLAVE_TIMEOUT = 10;</code> | ||
+ | | Timeout (Milliseconds) for RX/TX wait data | ||
+ | |- | ||
+ | | <code>BCM2708_I2CSLAVE_BUFFER_SIZE = 1024;</code> | ||
+ | | Size in bytes of the RX/TX data buffer | ||
+ | |- | ||
+ | | <code>BCM2708_I2CSLAVE_RX_POLL_LIMIT = 256;</code> | ||
+ | | Number of times interrupt handler may poll the read FIFO | ||
|- | |- | ||
|} | |} | ||
Line 385: | Line 404: | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
− | | <code>BCM2708_DMA_LITE_BURST_LENGTH = | + | | <code>BCM2708_DMA_LITE_BURST_LENGTH = 2;</code> |
| Burst length for DMA Lite channels | | Burst length for DMA Lite channels | ||
|- | |- | ||
− | | <code>BCM2708_DMA_NORMAL_BURST_LENGTH = | + | | <code>BCM2708_DMA_NORMAL_BURST_LENGTH = 4;</code> |
| Burst length for normal channels | | Burst length for normal channels | ||
|- | |- | ||
− | | <code>BCM2708_DMA_BULK_BURST_LENGTH = | + | | <code>BCM2708_DMA_BULK_BURST_LENGTH = 16;</code> |
| Burst length for DMA Bulk channels | | Burst length for DMA Bulk channels | ||
|- | |- | ||
Line 938: | Line 957: | ||
| <code>Remain:LongWord;</code> | | <code>Remain:LongWord;</code> | ||
| Bytes remaining for current transfer | | Bytes remaining for current transfer | ||
+ | |- | ||
+ | | <code>Error:LongBool;</code> | ||
+ | | True if an error occurred during the transfer | ||
|- | |- | ||
|colspan="2"|''Statistics Properties'' | |colspan="2"|''Statistics Properties'' | ||
Line 991: | Line 1,013: | ||
| <code>CoreClock:LongWord;</code> | | <code>CoreClock:LongWord;</code> | ||
| Core clock rate | | Core clock rate | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''BCM2708 I2C slave buffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PBCM2708I2CSlaveBuffer = ^TBCM2708I2CSlaveBuffer;</code> | ||
+ | |||
+ | <code>TBCM2708I2CSlaveBuffer = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Wait:TSemaphoreHandle;</code> | ||
+ | | Data ready semaphore | ||
+ | |- | ||
+ | | <code>Start:LongWord;</code> | ||
+ | | Index of first available buffer entry | ||
+ | |- | ||
+ | | <code>Count:LongWord;</code> | ||
+ | | Number of available entries in the buffer | ||
+ | |- | ||
+ | | <code>Buffer:array[0..(BCM2708_I2CSLAVE_BUFFER_SIZE - 1)] of Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''BCM2708 I2C slave''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PBCM2708I2CSlave = ^TBCM2708I2CSlave;</code> | ||
+ | |||
+ | <code>TBCM2708I2CSlave = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''I2C Properties'' | ||
+ | |- | ||
+ | | <code>I2C:TI2CDevice;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''BCM2708 Properties'' | ||
+ | |- | ||
+ | | <code>IRQ:LongWord;</code> | ||
+ | | IRQ of this device | ||
+ | |- | ||
+ | | <code>Address:Pointer;</code> | ||
+ | | Device register base address | ||
+ | |- | ||
+ | | <code>Lock:TSpinHandle;</code> | ||
+ | | Device lock (Differs from lock in I2C device) (Spin lock due to use by interrupt handler) | ||
+ | |- | ||
+ | | <code>SDAPin:LongWord;</code> | ||
+ | | GPIO pin for the SDA line | ||
+ | |- | ||
+ | | <code>SCLPin:LongWord;</code> | ||
+ | | GPIO pin for the SCL line | ||
+ | |- | ||
+ | | <code>SDAFunction:LongWord;</code> | ||
+ | | GPIO function for the SDA line | ||
+ | |- | ||
+ | | <code>SCLFunction:LongWord;</code> | ||
+ | | GPIO function for the SCL line | ||
+ | |- | ||
+ | |colspan="2"|''Transfer Properties'' | ||
+ | |- | ||
+ | | <code>Receive:TBCM2708I2CSlaveBuffer;</code> | ||
+ | | Receive Data Buffer | ||
+ | |- | ||
+ | | <code>Transmit:TBCM2708I2CSlaveBuffer;</code> | ||
+ | | Transmit Data Buffer | ||
+ | |- | ||
+ | |colspan="2"|''Statistics Properties'' | ||
+ | |- | ||
+ | | <code>InterruptCount:LongWord;</code> | ||
+ | | Number of interrupt requests received by the device | ||
|- | |- | ||
|} | |} | ||
Line 1,244: | Line 1,343: | ||
|- | |- | ||
|colspan="2"|''BCM2708 Properties'' | |colspan="2"|''BCM2708 Properties'' | ||
+ | |- | ||
+ | | <code>FIQ:LongBool;</code> | ||
+ | | | ||
|- | |- | ||
| <code>SDIO:LongBool;</code> | | <code>SDIO:LongBool;</code> | ||
Line 1,707: | Line 1,809: | ||
! Note | ! Note | ||
| Thread submitting the current request will hold the I2C device lock | | Thread submitting the current request will hold the I2C device lock | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''BCM2708 SPI/I2C slave functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function BCM2708I2CSlaveStart(I2C:PI2CDevice; Rate:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of I2CSlaveStart API for BCM2708 I2C slave</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use I2CSlaveStart instead. | ||
+ | Rate is not applicable for I2C slave devices | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function BCM2708I2CSlaveStop(I2C:PI2CDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of I2CSlaveStop API for BCM2708 I2C slave</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use I2CSlaveStop instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function BCM2708I2CSlaveRead(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of I2CSlaveRead API for BCM2708 I2C slave</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use I2CSlaveRead instead. | ||
+ | Address is not applicable for I2C slave devices | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function BCM2708I2CSlaveWrite(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of I2CSlaveWrite API for BCM2708 I2C slave</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use I2CSlaveWrite instead. | ||
+ | Address is not applicable for I2C slave devices | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function BCM2708I2CSlaveSetAddress(I2C:PI2CDevice; Address:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of I2CSlaveSetAddress API for BCM2708 I2C slave</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use I2CSlaveSetAddress instead. | ||
|- | |- | ||
|} | |} | ||
Line 2,346: | Line 2,514: | ||
! Note | ! Note | ||
| Not intended to be called directly by applications, use SDHCIHostStop instead. | | Not intended to be called directly by applications, use SDHCIHostStop instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function BCM2708SDHCIHostLock(SDHCI:PSDHCIHost):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostLock API for BCM2708 SDHCI</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use SDHCIHostLock instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function BCM2708SDHCIHostUnlock(SDHCI:PSDHCIHost):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostUnlock API for BCM2708 SDHCI</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use SDHCIHostUnlock instead. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function BCM2708SDHCIHostSignal(SDHCI:PSDHCIHost; Semaphore:TSemaphoreHandle):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostSignal API for BCM2708 SDHCI</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use SDHCIHostSignal instead. | ||
|- | |- | ||
|} | |} | ||
Line 2,840: | Line 3,044: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">function | + | <pre style="border: 0; padding-bottom:0px;">function BCM2708FramebufferSetOffsetEx(Framebuffer:PFramebufferDevice; X,Y:LongWord; Pan,Switch:Boolean):LongWord;</pre> |
− | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceSetOffsetEx API for BCM2708 Framebuffer</div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
! Note | ! Note | ||
− | | Not intended to be called directly by applications, use | + | | Not intended to be called directly by applications, use FramebufferDeviceSetOffsetEx instead. |
|- | |- | ||
|} | |} | ||
Line 2,907: | Line 3,111: | ||
! Note | ! Note | ||
| Not intended to be called directly by applications, use FramebufferDeviceUpdateCursor instead. | | Not intended to be called directly by applications, use FramebufferDeviceUpdateCursor instead. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
|} | |} | ||
Line 2,958: | Line 3,150: | ||
! Note | ! Note | ||
| The Id number supplied to this function may differ from the Ultibo device id value. | | The Id number supplied to this function may differ from the Ultibo device id value. | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function BCM2708I2CSlaveGetDescription(Id:LongWord):String;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the device description of an I2C slave device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Id | ||
+ | | The Id number of the I2C slave device (Always 0) | ||
+ | |- | ||
+ | ! Return | ||
+ | | The correct device description suitable for passing to I2CSlaveFindByDescription | ||
+ | |- | ||
+ | ! Note | ||
+ | | The Id number supplied to this function may differ from the Ultibo device id value | ||
|- | |- | ||
|} | |} |
Revision as of 03:49, 5 September 2023
Return to Unit Reference
Contents
[hide]Description
Ultibo BCM2708 Interface unit
This unit provides the BCM2708 specific implementations of the following devices:
- SPI0
- I2C0
- I2C1
- I2C2
- SPI1
- SPI2
- I2C Slave
- SPI Slave
- DMA
- PWM0
- PWM1
- PCM
- GPIO
- UART0
- UART1
- SDHCI (eMMC)
- Clock
- ARM Timer
- Random
- Mailbox
- Watchdog
- Framebuffer
- MIPI CSI-2 (Camera Serial Interface)
- DSI (Display Serial Interface)
BCM2708 SPI0 Device
The BCM2708 has a single master mode SPI controller that supports 3 wire, 2 wire and LoSSI modes of operation. It also has 2 auxiliary SPI masters which do not support DMA mode (see SPI1/2 below).
The main SPI0 controller supports polled, interrupt and DMA modes and includes 3 chip selects although only CS0 and 1 are available on the 26 or 40 pin header.
By default SPI0 can appear on GPIO pins 7 to 11 (CS1, CS0, MISO, MOSI, SCLK) using alternate function 0 or on GPIO pins 35 to 39 (CS1, CS0, MISO, MOSI, SCLK) using alternate function 0, only pins 7 to 11 are available on the header.
BCM2708 I2C0/1/2 Device
The BCM2708 has 3 Broadcom Serial Controller (BSC) devices which are fast mode (400Kz) masters numbered BSC0, BSC1 and BSC2.
Device BSC2 is dedicated to the HDMI interface but can be accessed by the ARM processor for controlling some HDMI functionality. All BSC devices contain a 16 byte FIFO, support 7 bit and 10 bit addressing and have software configurable clock timing.
By default BSC0 can appear on GPIO pins 0 and 1 (Alternate function 0), 28 and 29 (Alternate function 0) or 44 and 45 (Alternate function 1). Unfortunately on all except the Revision 1 models none of these pins are available on the 26 or 40 pin header.
Note: On the Raspberry Pi A+/B+/Zero/2B/3B the ID EEPROM pins on the 40 pin header are actually connected to GPIO 0 and 1 (BSC0)
Device BSC1 can appear on GPIO pins 2 and 3 (Alternate function 0) or 44 and 45 (Alternate function 2) but only pins 2 and 3 are exposed on the 26 or 40 pin header.
BCM2708 SPI1/2 Device
The BCM2708 has 2 additional SPI universal masters available as part of the AUX device which support interrupt mode but not DMA and therefore only allow limited bandwidth transfers due to the CPU overhead required to sustain high data rates.
Both devices support 3 chip selects, by default SPI1 is available on GPIO pins 16 to 21 (CS2, CS1, CS0, MISO, MOSI, SCLK) using alternate function 4 and SPI2 is available on GPIO pins 40 to 45 (MISO, MOSI, SCLK, CS0, CS1, CS2) using alternate function 4. Only pins 16 to 21 are available on the header and only on the 40 pin header of the Raspberry Pi A+/B+/Zero/2B/3B.
BCM2708 SPI/I2C Slave Device
The slave device can be used as either an I2C or an SPI interface, the I2C slave supports 400KHz fast mode operation. Only 7 bit addressing is supported, DMA is not supported and neither is clock stretching.
Note: On the Raspberry Pi A+/B+/Zero/2B/3B the SPI slave device is apparently faulty and cannot be used.
The I2C Slave device can only appear on GPIO pins 18 (SDA) and 19 (SCL) (Alternate function 3).
BCM2708 DMA Device
The DMA controller has 16 channels in total although not all are available for software to use as some are already used by the GPU.
The firmware will pass the value dma.dmachans on the command line which will indicate which channels are available for our use.
Channels 0 to 6 are normal channels which support 2D stride and transfers up to 1GB per control block
Channels 7 to 14 are Lite channels which do not support stride and only allow transfers up to 64KB per control block
Channel 15 is not mentioned in most documentation and is shown as not available in the mask passed in dma.dmachans
Channel 0 and 15 are Bulk channels which have an additional FIFO for faster transfers (8 beat burst per read)
BCM2708 PWM0/1 Device
The BCM2708 has a single PWM controller with 2 independent output bit streams with multiple algorithms for generating the output pulse. The PWM controller supports either a single data register (independent per channel) or a 16 x 32 FIFO which also supports DMA mode transmission.
On the Raspberry Pi PWM0 and PWM1 are also connected via GPIO pins 40 and 45 (40 and 41 on the Raspberry Pi 3B) to the audio circuit and allow playback of digital audio signals via the 3 or 4 pole line jack (depending on model).
PWM0 is available on GPIO pins 12 (function 0), 18 (function 5), 40 (function 0) and 52 (function 1).
PWM1 is available on GPIO pins 13 (function 0), 19 (function 5), 41, 45 (function 0) and 53 (function 1).
On the Raspberry Pi A and B only pin 18 is exposed on the 26 pin header.
On the Raspberry Pi A+/B+/Zero/2B/3B pins 12, 13, 18 and 19 are exposed on the 40 pin header.
BCM2708 GPIO Device
The GPIO has 54 pins available each with multiple alternate functions. All pins can be configured as input or output and all can have pull up or down applied.
Not all pins are exposed on the 26 or 40 pin header of the Raspberry Pi, for details of which pins are available see:
Raspberry Pi A and B - https://www.raspberrypi.org/documentation/usage/gpio/README.md
Raspberry Pi A+/B+/2B/3B/Zero - https://www.raspberrypi.org/documentation/usage/gpio-plus-and-raspi2/README.md
Some of the 54 pins are used for peripheral communication (such as the SD card) and are not available for general use, take care when changing function selects on pins to avoid disabling certain system peripherals.
Event detection can be enabled for both high and low levels as well as rising and falling edges, there is also an asynchronous rising or falling edge detection which can detect edges of very short duration.
BCM2708 UART0 Device
The UART0 device is an ARM PL011 UART which supports programmable baud rates, start, stop and parity bits and hardware flow control and many others. The UART0 is similar to the industry standard 16C650 but with a number of differences, the PL011 has some optional features such as IrDA, Serial InfraRed and DMA which are not supported by the Broadcom implementation. In the standard configuration the UART0 TX and RX lines are connected to GPIO pins 14 and 15 respectively (Alternate function 0) but they can be remapped via GPIO function selects to a number of other locations. On the Raspberry Pi (all models) none of these alternate pin mappings are exposed via the 26 or 40 pin header and therefore cannot be used easily. This means that UART0 and UART1 cannot be used at the same time.
On the Raspberry Pi 3B the UART0 can be mapped to GPIO pins 32 and 33 (Alternate function 3) to communicate with the built in Bluetooth module.
BCM2708 UART1 Device
The UART1 device is a Broadcom implementation that is part of the AUX device which also includes the SPI1 and SPI2 devices. This device is termed a Mini UART and has a smaller feature set than the PL011 UART but still supports a fairly standard communication protocol with programmable baud rate and hardware flow control.
The Mini UART is similar to the standard 16550 device but is missing some of the features, the device also has no DMA support so high speed transfers will produce a higher CPU load. In the standard configuration the UART1 TX and RX lines are connected to GPIO pins 14 and 15 respectively (Alternate function 5) but they can be remapped via GPIO function selects to a number of other locations. On the Raspberry Pi (all models) none of these alternate pin mappings are exposed via the 26 or 40 pin header and therefore cannot be used easily. This means that UART0 and UART1 cannot be used at the same time.
On the Raspberry Pi 3B the UART1 can be mapped to GPIO pins 32 and 33 (Alternate function 5) to communicate with the built in Bluetooth module.
BCM2708 SDHCI Device
The SDHCI controller on the BCM2708 is an Arasan SD Host controller.
The Card Detect pin is connected to GPIO pin 47 (on the RPi Model A/B)(Not connected on the RPi Model A+/B+)
The Write Protect pin is not connected.
The device can be routed to GPIO pins 22 to 27 (ALT3) or 48 to 53 (ALT3), it can also be routed to GPIO pins 34 to 39 (ALT3) to provide an SDIO controller for the on board WiFi.
BCM2708 SDHOST Device
The SDHOST controller on the BCM2708 is a non SDHCI-compliant device which requires a specific driver.
It can be routed to GPIO pins 22 to 27 (ALT0) or 48 to 53 (ALT0) in order to control the SD card slot when the SDHCI device is being used for the on board WiFi.
Note: The actual driver is implemented in the BCMSDHOST unit.
BCM2708 Clock (System Timer) Device
The clock device in the BCM2708 is based on the System Timer which is a 64 bit free running counter that runs at 1MHz regardless of core or CPU clock speeds. The System Timer cannot be stopped and the counter cannot be set or reset.
The System Timer includes 4 compare registers which can each generate an interrupt when the compare value is matched, however 2 of the 4 are consumed by the GPU and on the Raspberry Pi A/B/A+/B+/Zero the other 2 are used for the scheduler and clock interrupts in Ultibo.
This device simply exposes the free running counter as a clock value and does not provide access to the timer compare functionality or to interrupt based events, for those see the timer devices below.
BCM2708 Clock (ARM Timer) Device
This device represents that free running counter from the ARM Timer device (below) as a clock device. The free running counter does not appear in the original SP804 timer. The counter is 32 bits wide and has its own divider that is 8 bits wide meaning that it can be set to clock rates of between 975KHz and 250MHz (or 1.5MHz to 400MHz on the Raspberry Pi 3B).
The counter does not generate an interrupt and cannot be set or reset but it can be stopped and started.
BCM2708 ARM Timer Device
The ARM Timer device in the BCM2708 is based on the ARM SP804 timer with some modifications and additions. In the Raspberry Pi it is connected to the core clock which by default is 250MHz but was increased to 400MHz on the Raspberry Pi 3B.
The divider is 10 bits wide which means that the ARM Timer can be set to clock rates of between 250KHz and 250MHz (or 400KHz to 400MHz on the Raspberry Pi 3B). Both the counter and the load/reload value are 32 bits wide by default giving a wide range of tick intervals.
The ARM Timer features a free running counter which is not enabled or used by this driver and a down counter which operates in wrapping mode so that each time it reaches 0 it triggers an interrupt and reloads the value from a load or reload register to begin counting again.
Constants
BCM2708_SPI0_*
BCM2708_BSCI2C_*
BCM2708_I2C0_*
BCM2708_I2C1_*
BCM2708_I2C2_*
BCM2708_SPI1_*
BCM2708_SPI2_*
BCM2708_I2CSLAVE_*
BCM2708_SPISLAVE_*
BCM2708_DMA_*
BCM2708_PWM_*
BCM2708_PWM0_*
BCM2708_PWM1_*
BCM2708_GPIO_*
BCM2708_UART0_*
BCM2708_UART1_*
BCM2708_EMMC_*
BCM2708_SDHOST_*
BCM2708_SYS_CLOCK_*
BCM2708_ARM_CLOCK_*
BCM2708_ARM_TIMER_*
BCM2708_RANDOM_*
BCM2708_MAILBOX_*
BCM2708_WATCHDOG_*
BCM2708_FRAMEBUFFER_*
Type definitions
BCM2708 SPI0
BCM2708 BSCI2C (I2C0/1/2) device
BCM2708 BSCI2C (I2C0/1) IRQ data
BCM2708 SPI AUX (SPI1/2)
BCM2708 I2C slave buffer
BCM2708 I2C slave
BCM2708 DMA channel
BCM2708 DMA
BCM2708 PWM device
BCM2708 PWM audio
BCM2708 GPIO
BCM2708 GPIO device
BCM2708 UART0
BCM2708 SDHCI
BCM2708 system clock
BCM2708 ARM clock
BCM2708 ARM timer
BCM2708 random
BCM2708 mailbox
BCM2708 watchdog
BCM2708 framebuffer
Public variables
None defined
Function declarations
Initialization functions
BCM2708 SPI0 functions
function BCM2708SPI0Start(SPI:PSPIDevice; Mode,ClockRate,ClockPhase,ClockPolarity:LongWord):LongWord;
function BCM2708SPI0WriteRead(SPI:PSPIDevice; ChipSelect:Word; Source,Dest:Pointer; Size,Flags: LongWord; var Count:LongWord):LongWord;
function BCM2708SPI0SetMode(SPI:PSPIDevice; Mode:LongWord):LongWord;
function BCM2708SPI0SetClockRate(SPI:PSPIDevice; ChipSelect:Word; ClockRate:LongWord):LongWord;
function BCM2708SPI0SetClockPhase(SPI:PSPIDevice; ClockPhase:LongWord):LongWord;
function BCM2708SPI0SetClockPolarity(SPI:PSPIDevice; ClockPolarity:LongWord):LongWord;
function BCM2708SPI0SetSelectPolarity(SPI:PSPIDevice; ChipSelect:Word; SelectPolarity:LongWord):LongWord;
procedure BCM2708SPI0ReadFIFO(SPI:PBCM2708SPI0Device);
procedure BCM2708SPI0WriteFIFO(SPI:PBCM2708SPI0Device);
procedure BCM2708SPI0InterruptHandler(SPI:PBCM2708SPI0Device);
procedure BCM2708SPI0DMARequestCompleted(Request:PDMARequest);
BCM2708 BSCI2C (I2C0/1/2) functions
function BCM2708BSCI2CStart(I2C:PI2CDevice; Rate:LongWord):LongWord;
function BCM2708BSCI2CRead(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
function BCM2708BSCI2CWrite(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
function BCM2708BSCI2CWriteRead(I2C:PI2CDevice; Address:Word; Initial:Pointer; Len:LongWord; Data:Pointer; Size:LongWord; var Count:LongWord):LongWord;
function BCM2708BSCI2CWriteWrite(I2C:PI2CDevice; Address:Word; Initial:Pointer; Len:LongWord; Data:Pointer; Size:LongWord; var Count:LongWord):LongWord;
function BCM2708BSCI2CSetRate(I2C:PI2CDevice; Rate:LongWord):LongWord;
function BCM2708BSCI2CSetAddress(I2C:PI2CDevice; Address:Word):LongWord;
procedure BCM2708BSCI2CFillFIFO(I2C:PBCM2708BSCI2CDevice);
procedure BCM2708BSCI2CDrainFIFO(I2C:PBCM2708BSCI2CDevice);
procedure BCM2708BSCI2CInterruptHandler(IRQData:PBCM2708BSCI2CIRQData);
BCM2708 SPI/I2C slave functions
function BCM2708I2CSlaveStart(I2C:PI2CDevice; Rate:LongWord):LongWord;
function BCM2708I2CSlaveStop(I2C:PI2CDevice):LongWord;
function BCM2708I2CSlaveRead(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
function BCM2708I2CSlaveWrite(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
function BCM2708I2CSlaveSetAddress(I2C:PI2CDevice; Address:Word):LongWord;
BCM2708 DMA functions
function BCM2708DMAHostSubmit(DMA:PDMAHost; Request:PDMARequest):LongWord;
function BCM2708DMAHostCancel(DMA:PDMAHost; Request:PDMARequest):LongWord;
procedure BCM2708DMAInterruptHandler(Channel:PBCM2708DMAChannel);
procedure BCM2708DMASharedInterruptHandler(DMA:PBCM2708DMAHost);
procedure BCM2708DMARequestComplete(Channel:PBCM2708DMAChannel);
function BCM2708DMAPeripheralToDREQ(Peripheral:LongWord):LongWord;
procedure BCM2708DMADataToControlBlock(Request:PDMARequest; Data:PDMAData; Block:PBCM2835DMAControlBlock; Bulk,Lite:Boolean);
BCM2708 PWM0/1 functions
function BCM2708PWMWrite(PWM:PPWMDevice; Value:LongWord):LongWord;
function BCM2708PWMSetGPIO(PWM:PPWMDevice; GPIO:LongWord):LongWord;
function BCM2708PWMResetGPIO(PWM:PPWMDevice; GPIO:LongWord):LongWord;
function BCM2708PWMSetMode(PWM:PPWMDevice; Mode:LongWord):LongWord;
function BCM2708PWMSetRange(PWM:PPWMDevice; Range:LongWord):LongWord;
function BCM2708PWMSetFrequency(PWM:PPWMDevice; Frequency:LongWord):LongWord;
function BCM2708PWMSetPolarity(PWM:PPWMDevice; Polarity:LongWord):LongWord;
function BCM2708PWMConfigure(PWM:PPWMDevice; DutyNS,PeriodNS:LongWord):LongWord;
function BCM2708PWMClockStart(PWM:PPWMDevice; Frequency:LongWord):LongWord;
BCM2708 GPIO functions
function BCM2708GPIORead(GPIO:PGPIODevice;Reg:LongWord):LongWord;
procedure BCM2708GPIOWrite(GPIO:PGPIODevice; Reg,Value:LongWord);
function BCM2708GPIOInputGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
function BCM2708GPIOInputWait(GPIO:PGPIODevice; Pin,Trigger,Timeout:LongWord):LongWord;
function BCM2708GPIOInputEvent(GPIO:PGPIODevice; Pin,Trigger,Flags,Timeout:LongWord; Callback:TGPIOCallback; Data:Pointer):LongWord;
function BCM2708GPIOInputCancel(GPIO:PGPIODevice; Pin:LongWord):LongWord;
function BCM2708GPIOOutputSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;
function BCM2708GPIOPullSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
function BCM2708GPIOFunctionGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
function BCM2708GPIOFunctionSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
procedure BCM2708GPIOInterruptHandler(Bank:PBCM2708GPIOBank);
BCM2708 UART0 functions
function BCM2708UART0Open(UART:PUARTDevice; BaudRate,DataBits,StopBits,Parity,FlowControl:LongWord):LongWord;
function BCM2708UART0Close(UART:PUARTDevice):LongWord;
function BCM2708UART0Read(UART:PUARTDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
function BCM2708UART0Write(UART:PUARTDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
function BCM2708UART0GetStatus(UART:PUARTDevice):LongWord;
function BCM2708UART0SetStatus(UART:PUARTDevice; Status:LongWord):LongWord;
procedure BCM2708UART0InterruptHandler(UART:PUARTDevice);
procedure BCM2708UART0Receive(UART:PUARTDevice);
procedure BCM2708UART0Transmit(UART:PUARTDevice);
procedure BCM2708UART0EnableInterrupt(UART:PBCM2708UART0Device; Interrupt:LongWord);
procedure BCM2708UART0DisableInterrupt(UART:PBCM2708UART0Device; Interrupt:LongWord);
BCM2708 SDHCI functions
function BCM2708SDHCIHostStart(SDHCI:PSDHCIHost):LongWord;
function BCM2708SDHCIHostStop(SDHCI:PSDHCIHost):LongWord;
function BCM2708SDHCIHostLock(SDHCI:PSDHCIHost):LongWord;
function BCM2708SDHCIHostUnlock(SDHCI:PSDHCIHost):LongWord;
function BCM2708SDHCIHostSignal(SDHCI:PSDHCIHost; Semaphore:TSemaphoreHandle):LongWord;
function BCM2708SDHCIHostReadByte(SDHCI:PSDHCIHost; Reg:LongWord):Byte;
function BCM2708SDHCIHostReadWord(SDHCI:PSDHCIHost; Reg:LongWord):Word;
function BCM2708SDHCIHostReadLong(SDHCI:PSDHCIHost; Reg:LongWord):LongWord;
procedure BCM2708SDHCIHostWriteByte(SDHCI:PSDHCIHost; Reg:LongWord; Value:Byte);
procedure BCM2708SDHCIHostWriteWord(SDHCI:PSDHCIHost; Reg:LongWord; Value:Word);
procedure BCM2708SDHCIHostWriteLong(SDHCI:PSDHCIHost; Reg:LongWord; Value:LongWord);
procedure BCM2708SDHCIInterruptHandler(SDHCI:PSDHCIHost);
function BCM2708SDHCISetupInterrupts(SDHCI:PSDHCIHost):LongWord;
function BCM2708MMCDeviceGetCardDetect(MMC:PMMCDevice):LongWord;
BCM2708 system clock functions
function BCM2708SystemClockRead(Clock:PClockDevice):LongWord;
function BCM2708SystemClockRead64(Clock:PClockDevice):Int64;
BCM2708 ARM clock functions
function BCM2708ARMClockStart(Clock:PClockDevice):LongWord;
function BCM2708ARMClockStop(Clock:PClockDevice):LongWord;
function BCM2708ARMClockRead(Clock:PClockDevice):LongWord;
function BCM2708ARMClockRead64(Clock:PClockDevice):Int64;
function BCM2708ARMClockSetRate(Clock:PClockDevice; Rate:LongWord):LongWord;
BCM2708 ARM timer functions
function BCM2708ARMTimerStart(Timer:PTimerDevice):LongWord;
function BCM2708ARMTimerStop(Timer:PTimerDevice):LongWord;
function BCM2708ARMTimerRead64(Timer:PTimerDevice):Int64;
function BCM2708ARMTimerWait(Timer:PTimerDevice):LongWord;
function BCM2708ARMTimerEvent(Timer:PTimerDevice; Flags:LongWord; Callback:TTimerCallback; Data:Pointer):LongWord;
function BCM2708ARMTimerCancel(Timer:PTimerDevice):LongWord;
function BCM2708ARMTimerSetRate(Timer:PTimerDevice; Rate:LongWord):LongWord;
function BCM2708ARMTimerSetInterval(Timer:PTimerDevice; Interval:LongWord):LongWord;
procedure BCM2708ARMTimerInterruptHandler(Timer:PTimerDevice);
procedure BCM2708ARMTimerEventTrigger(Timer:PTimerDevice);
BCM2708 random functions
function BCM2708RandomReadLongWord(Random:PRandomDevice):LongWord;
BCM2708 watchdog functions
function BCM2708WatchdogStart(Watchdog:PWatchdogDevice):LongWord;
function BCM2708WatchdogStop(Watchdog:PWatchdogDevice):LongWord;
function BCM2708WatchdogRefresh(Watchdog:PWatchdogDevice):LongWord;
function BCM2708WatchdogGetRemain(Watchdog:PWatchdogDevice):LongWord;
BCM2708 framebuffer functions
function BCM2708FramebufferAllocate(Framebuffer:PFramebufferDevice; Properties:PFramebufferProperties):LongWord;
function BCM2708FramebufferRelease(Framebuffer:PFramebufferDevice):LongWord;
function BCM2708FramebufferBlank(Framebuffer:PFramebufferDevice; Blank:Boolean):LongWord;
function BCM2708FramebufferCommit(Framebuffer:PFramebufferDevice;Address:PtrUInt;Size,Flags:LongWord):LongWord;
function BCM2708FramebufferWaitSync(Framebuffer:PFramebufferDevice):LongWord;
function BCM2708FramebufferSetOffsetEx(Framebuffer:PFramebufferDevice; X,Y:LongWord; Pan,Switch:Boolean):LongWord;
function BCM2708FramebufferGetPalette(Framebuffer:PFramebufferDevice; Palette:PFramebufferPalette):LongWord;
function BCM2708FramebufferSetPalette(Framebuffer:PFramebufferDevice; Palette:PFramebufferPalette):LongWord;
function BCM2708FramebufferSetBacklight(Framebuffer:PFramebufferDevice; Brightness:LongWord):LongWord;
function BCM2708FramebufferSetCursor(Framebuffer:PFramebufferDevice; Width,Height,HotspotX,HotspotY:LongWord; Image:Pointer; Len:LongWord):LongWord;
function BCM2708FramebufferUpdateCursor(Framebuffer:PFramebufferDevice; Enabled:Boolean; X,Y:LongInt; Relative:Boolean):LongWord;
BCM2708 helper functions
function BCM2708SPIGetDescription(Id:LongWord):String;
function BCM2708I2CGetDescription(Id:LongWord):String;
function BCM2708I2CSlaveGetDescription(Id:LongWord):String;
function BCM2708PWMGetDescription(Id,Channel:LongWord):String;
function BCM2708UARTGetDescription(Id:LongWord):String;
Return to Unit Reference