|
一个已完成的硬件方案,重新用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é ç½®
请教STM32F103的DMA空闲接收问题
3.3v单片机能刷写1.8v的spi flash吗?
STM32CubeMX配置STM32F103C8T6 RTC分频器问题
STM32F103RCT6断电以后,ADC会漏电
STM32F103VCT6通过串口1烧录程序问题
F103的IIC支持高速400K频率吗?
为什么用cubemax生成f103c8t6的freertos在编译时会报错
CUBEIDE打开一个工程,怎么改变主控芯片的同系列型号?
STM32F103 使用PA9输出PWM问题
STM32F103C8T6是否支持TIM3的PWM边沿触发AD采集
微信公众号
手机版