-
GD32F305SPI没有时钟信号
使用了官方例程,芯片也换过,用示波器就是没检测到sck信号而且使用这个历程之后到spi0_receive_array[receive_cnt]=spi_i2s_data_receive(spi0_send_array[send_cnt]);这行代码就不能往下执行了,send_n只接收一次下面是代码这是SPI的配置spi.c#include"SPI.h"#include"gd32f30x_spi.h"#include"systick.h"voidspi0_init(void){rcu_periph_clock_enable(RCU_GPIOA);rcu_periph_clock_enable(SPI0);rcu_periph_clock_enable(RCU_AF);/*SCK->PA5MISO->PA6MOSI->PA7SPI1:MASTER*/gpio_init(GPIOA,GPIO_MODE_AF_PP,GPIO_OSPEED_50MHZ,GPIO_PIN_5|GPIO_PIN_7);gpio_init(GPIOA,GPIO_MODE_IN_FLOATING,GPIO_OSPEED_50MHZ,GPIO_PIN_6);spi_parameter_structspi_init_struct;spi_i2s_deinit(SPI0);spi_init_struct.trans_mode=SPI_TRANSMODE_FULLDUPLEX;spi_init_struct.device_mode=SPI_MASTER;spi_init_struct.nss=SPI_NSS_SOFT;spi_init_struct.clock_polarity_phase=SPI_CK_PL_LOW_PH_1EDGE;spi_init_struct.frame_size=SPI_FRAMESIZE_8BIT;spi_init_struct.endian=SPI_ENDIAN_MSB;spi_init_struct.prescale=SPI_PSC_8;spi_enable(SPI0);}voidspi1_init(void){rcu_periph_clock_enable(RCU_GPIOB);rcu_periph_clock_enable(SPI1);rcu_periph_clock_enable(RCU_AF);/*SCK->PB13MISO->PB14MOSI->PB15SPI1:SLAVE*/gpio_init(GPIOB,GPIO_MODE_AF_PP,GPIO_OSPEED_50MHZ,GPIO_PIN_13|GPIO_PIN_14);gpio_init(GPIOB,GPIO_MODE_IN_FLOATING,GPIO_OSPEED_50MHZ,GPIO_PIN_15);spi_parameter_structspi_init_struct;spi_i2s_deinit(SPI1);spi_init_struct.trans_mode=SPI_TRANSMODE_FULLDUPLEX;spi_init_struct.device_mode=SPI_SLAVE;spi_init_struct.nss=SPI_NSS_SOFT;spi_init_struct.clock_polarity_phase=SPI_CK_PL_LOW_PH_1EDGE;spi_init_struct.frame_size=SPI_FRAMESIZE_8BIT;spi_init_struct.endian=SPI_ENDIAN_MSB;spi_enable
2023-07-20 4