軟件模擬能驅(qū)動(dòng)? 但是換成硬件spi
就不行? spi初始化和103上一模一樣,103就可以,003就不行
?引腳設(shè)置:
GPIO_InitStructure.GPIO_Pin?=?GPIO_Pin_5; ????GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_Out_PP; ????GPIO_InitStructure.GPIO_Speed?=?GPIO_Speed_50MHz; ????GPIO_Init(?GPIOC,?&GPIO_InitStructure?); ????GPIO_InitStructure.GPIO_Pin?=?GPIO_Pin_6; ????GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_AF_PP; ????GPIO_Init(?GPIOC,?&GPIO_InitStructure?); ???GPIO_SetBits(GPIOC,GPIO_Pin_5|GPIO_Pin_6); ???引腳模式推挽輸出,復(fù)用都試過?沒用; ??? ???spi初始化, ???void?lcd_spi_init(void) { ????SPI_InitTypeDef??SPI_InitStructure?=?{0}; ????RCC_APB2PeriphClockCmd(?RCC_APB2Periph_SPI1,?ENABLE); ????SPI_InitStructure.SPI_Direction?=?SPI_Direction_1Line_Tx; ????SPI_InitStructure.SPI_Mode?=?SPI_Mode_Master; ????SPI_InitStructure.SPI_DataSize?=?SPI_DataSize_8b; ????SPI_InitStructure.SPI_CPOL?=?SPI_CPOL_High;//串行同步時(shí)鐘空閑時(shí)SCLK位高電平 ????SPI_InitStructure.SPI_CPHA?=?SPI_CPHA_2Edge;//串行同步時(shí)鐘空第二個(gè)時(shí)鐘沿捕獲 ????SPI_InitStructure.SPI_NSS?=?SPI_NSS_Soft; ????SPI_InitStructure.SPI_BaudRatePrescaler?=?SPI_BaudRatePrescaler_128; ????SPI_InitStructure.SPI_FirstBit?=?SPI_FirstBit_MSB; ????//SPI_InitStructure.SPI_CRCPolynomial?=?7; ????SPI_Init(SPI1,?&SPI_InitStructure); ????SPI_Cmd(SPI1,?ENABLE); }
熱門產(chǎn)品 :
CH585: 集成高速USB和NFC的藍(lán)牙MCU