zynq spi

Master Mode


In master mode, the SPI I/O interface can transmit data to a slave or initiate a transfer to receive data
from a slave. The controller selects one slave device at the time using one of the three slave select
lines
. If more than three slave devices need to be connected to the master, it is possible to add an
external peripheral select 3-to-8 decode on the board
 

Data Transfer


The SCLK clock and MOSI signals are under control of the master. Data to be transmitted is written
into the TxFIFO by software using register writes and then unloaded for transmission by the
controller hardware in a manual or automatic start sequence. Data is driven onto the master output
(MOSI) data pin. Transmission is continuous while there is data in the TxFIFO.
Data is received serially on the MISO data pin and is loaded 8 bits at a time into the RxFIFO. Software
reads the RxFIFO using register reads. For every “n” bytes written to the TxFIFO, there will be “n”
bytes stored in RxFIFO that must be read by software before starting the next transfer
 

 Auto/Manual SS and Start
 

FIFO Interrupts

Interrupt Register Bits, Logic Flow


 

Start-up Sequence

问题


int SPIChipSelectInit(SPI_CS_ID_T ChipSelect)
{
	unsigned int GPIOBankID, GPIOPinID;

	if(JUDGE_SPI_CS_IS_MIO(ChipSelect))
	{
		return 0;
	}

	GPIOBankID = GET_SPI_CS_GPIO_BANK_ID(ChipSelect);
	GPIOPinID = GET_SPI_CS_GPIO_PIN_ID(ChipSelect);

	// set GPIO direction is output
	GPIOSetPinDirection(GPIOBankID, GPIOPinID, GPIO_DIR_OUT);

	// enable output
	GPIOPinOutEnable(GPIOBankID, GPIOPinID);

	// set initialization value
	GPIOWritePinData(GPIOBankID, GPIOPinID, GPIO_OUTPUT_HIGH);

	return 0;
}

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值