1.用spimaster的例子改写,SPI传输数据没有成功,从设备是一片ADC,怎么验证初始化数据有没有成功写入到从机中呢?
2.测试CS片选端的电压一直是高电平3.3V是正常的吗,CS端不是低电平有效吗?这样就代表我的从设备一直没有被选中吗?
Viki Shi:
1、用示波器抓一下波形,看数据是否发出
2、CS 我记得应该是自动选择,等我找一下文件
,
user6390304:
好的,如果TI例程中SPI初始设置是CS高电平有效,请问修改哪里的文件,怎么修改成低电平选中从设备?
,
Viki Shi:
自动选择的说法可能有误解,我指的是硬件片选。不是高电平有效,是低电平有效的
默认是硬件片选,描述如下:
Asserting on Chip Select
The SPI protocol requires that the SPI master asserts a SPI slave's chip select pin prior to starting a SPI transaction. While this protocol is generally followed, various types of SPI peripherals have different timing requirements as to when and for how long the chip select pin must remain asserted for a SPI transaction.Commonly, the SPI master uses a hardware chip select to assert and de-assert the SPI slave for every data frame. In other cases, a SPI slave imposes the requirement of asserting the chip select over several SPI data frames. This is generally accomplished by using a regular, general-purpose output pin. Due to the complexity of such SPI peripheral implementations, this SPI driver has been designed to operate transparently to the SPI chip select. When the hardware chip select is used, the peripheral automatically selects/enables the peripheral. When using a software chip select, the application needs to handle the proper chip select and pin configuration. Chip select support will vary per SPI peripheral, refer to the device specific implementation documentation for details on chip select support.
Hardware chip select No additional action by the application is required.
Software chip select The application needs to handle the chip select assertion and de-assertion for the proper SPI peripheral.
,
user6390304:
这个是啥意思呀,就是说硬件片选不需要设置高低电平有效吗?我的ADC芯片SPI的CS是低电平有效,那我测得CS是高电平的话也能正常通信吗?
,
Viki Shi:
对,硬件自动片选,不需要软件操作。CS必须是低电平有效,这是协议约定俗成的
,
user6390304:
那我测得连接上后还是高电平是不是代表SPI没有·正常通信传输啊
,
Viki Shi:
是的,可以看一下手册的时序图:
,
user6458813:
你得用逻辑分析仪或者示波器抓一下信号