|
一个已完成的硬件方案,重新用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é ç½®
KEILMDK每次都要手动选Reset and Run吗 不然下载到板子上得重启电源才行 求解答
STM32F103的USB的虚拟串口,串口助手打开的时候会收到两条数据,第一条数据是前5秒串口助手未打开时发送的,这怎么解决?
询问电源纹波对芯片的影响
STM32F103C8T6 上电后无法通过串口发出数据的问题?
VL53L5CX无法使用
stm32f107裸机+HR911105A+lwIP 1.31 SYN发送失败的问题
MCU的ADC进行电压采集时,外部输入阻抗最大能到多少?
STM32F103C8T6如何将变量定义到指定地址
STM32F103 做的USB CDC 串口调试助手打不开
DSP傅里叶变换如何在f103CBT6上使用
微信公众号
手机版