APB协议学习笔记
APB(Advanced Peripheral Bus)信号的格式可以归纳为以下几类信号,并以P
为前缀:
-
系统信号
:
PCLK
:系统时钟信号,用于同步APB总线上的操作。PRESETn
:系统复位信号,低电平有效。当该信号为低时,APB总线上的所有设备和信号都将被复位到初始状态。
-
Master信号
(由APB Bridge或主设备发出):
PADDR
:地址信号,用于确定读写的地址,最大支持32位。PSELx
:片选信号,用于选中与APB总线连接的Slave设备。当某个Slave设备被选中时,对应的PSELx
信号会被拉高。PENABLE
:使能信号,在PSELx
拉高一个周期后,该信号必定拉高,表示数据传输开始。PWRITE
:写使能信号。当PWRITE
为高时,表示进行写操作;为低时,表示进行读操作。PWDATA
:写数据信号,用于传输要写入Slave设备的数据,最大支持32位。
-
Slave信号
(由Slave设备发出):
PREADY
:就绪信号。当PREADY
为高时,表示Slave设备已经准备好数据传输,可以结束当前APB数据传输。PRDATA
:读数据信号,用于传输从Slave设备读出的数据,最大支持32位。PSLVERR
:错误数据信号(可选)。当Slave设备发现内部逻辑出现故障时,可以通过拉高该信号来通知Master设备。如果Master设备接收到PSLVERR
为高,即使PREADY
拉高表示APB传输结束,Master设备也可以选择放弃该次传输或采取其他应对策略。
此外,APB总线还拥有两个独立的数据通道:读通道和写通道。但由于这两个通道没有独立的握手信号,因此它们不会被同时使用。
总的来说,APB信号的格式和传输协议是高度结构化和规范的,确保了数据在低速、低功耗的外设与主系统之间的稳定、可靠传输。
APB Signals
Name | Source | Description |
---|---|---|
PCLK | Clock Source | The rising edge of PCLK is used to time all transfers on the APB. |
PRESETn | Reset Controller | The APB bus reset signal is active LOW and this signal will normally be connected directly to the system bus reset signal. |
PADDR[31:0] | Master | This is the APB address bus, which may be up to 32-bits wide and is driven by the peripheral bus bridge unit. |
PSELx | Decoder | A signal from the secondary decoder, within the peripheral bus bridge unit, to each peripheral bus slave x. This signal indicates that the slave device is selected and a data transfer is required. There is a PSELx signal for each bus slave. |
PENABLE | Master | This strobe signal is used to time all accesses on the peripheral bus. The enable signal is used to indicate the second cycle of an APB transfer. The rising edge of PENABLE occurs in the middle of the APB transfer. |
PWRITE | Master | When HIGH this signal indicates an APB write access and when LOW a read access. |
PRDATA[31:0] | Slave | The read data bus is driven by the selected slave during read cycles (when PWRITE is LOW). The read data bus can be up to 32-bits wide. |
PWDATA[31:0] | Master | The write data bus is driven by the peripheral bus bridge unit during write cycles (when PWRITE is HIGH). The write data bus can be up to 32-bits wide. |