你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

STM32F103中SPI Received Only的问题

[复制链接]
cloudcn 提问时间:2016-3-20 21:20 /
一个已完成的硬件方案,重新用CUBE重新配置,功能是用SPI接口驱动一片ADC
SPI能够接收16位数据即可,PA5 (SCK) PA6(MISO)接ADC 的 SCK MOSI,ADC需要一个周期的矩型波控制启动转换 PA7接到ADC的CONV引脚上

硬件与配置 PA5 PA6 PA7
IO配置
PA5 ALT_PP (SPI_SCK)
PA6 INPUT_PP (SPI_MISO)
PA7 ALT_PP (TIM3_CH2) 用PWM方式产生脉冲

结果发现无论怎么配置TIM3 PA7死活得不到PWM脉冲,结果发现
CUBE给的代码中将SPI1 CR1的RXONLY为1,而原来的SPI1 CR1的RXONLY 为0
RXONLY改成0脉冲就有了
这个是TIM3_CH2有输出的SPI配置

只要点上RXONLY脉冲就没了
查找数据手册
1 clock and 1 unidirectional data wire (BIDIMODE=0)
In this mode, the application can use the SPI either in transmit-only mode or in receive-only
mode.
● Transmit-only mode is similar to full-duplex mode (BIDIMODE=0, RXONLY=0): the data
are transmitted on the transmit pin (MOSI in master mode or MISO in slave mode) and
the receive pin (MISO in master mode or MOSI in slave mode) can be used as a
general-purpose IO. In this case, the application just needs to ignore the Rx buffer (if
the data register is read, it does not contain the received value).
In receive-only mode, the application can disable the SPI output function by setting the
RXONLY bit in the SPI_CR2 register.
In this case, it frees the transmit IO pin (MOSI in
master mode
or MISO in slave mode), so it can be used for other purposes.

按这个描述 正确做法是 设置RXONLY位 主模式的PA7就被释放出来,可做它用
而事实确是相反
不知道是那里弄错了,还是有别的什么问题

有输出的SPI配置

有输出的SPI配置
收藏 评论0 发布时间:2016-3-20 21:20

举报

0个回答
关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版