|
悬赏1RD币未解决
SC6531平台,使用SPI0_1接口进行TFT液晶屏幕驱动,向SPI总线写数据,用示波器测试总线上无数据。调试了好久也没有进展,还请做过的给指点一下。测试驱动代码如下:- kal_uint8 temp = 0xAA;
- T_spi_dev spi_dev;
- SPI_PAD_CFG_T pad_cfg;
- uint32 spi_arg;
- spi_dev.dev.id = SPI0_1_CS0;
- spi_dev.dev.mode = CPOL0_CPHA0;
- spi_dev.dev.tx_bit_length = 8;
- spi_dev.dev.freq = 24000000;
- spi_dev.dev.spi_cs_cb = PNULL;
- spi_dev.dev.spi_tx_cb = PNULL;
- spi_dev.dev.spi_rx_cb = PNULL;
- CHIP_REG_AND(PIN_LCMD1_REG,0);
- CHIP_REG_AND(PIN_LCMD2_REG,0);
- CHIP_REG_AND(PIN_LCMD3_REG,0);
- CHIP_REG_AND(PIN_LCMD5_REG,0);
- CHIP_REG_OR(PIN_LCMD1_REG,( PIN_SLP_Z | PIN_SPD_EN | PIN_SPO_X | PIN_FUNC_1 | PIN_FPX_EN | PIN_DS_2 | PIN_SPC_EN));// GPIO_54 :
- CHIP_REG_OR(PIN_LCMD2_REG,( PIN_SLP_Z | PIN_SPD_EN | PIN_SPO_X | PIN_FUNC_1 | PIN_FPX_EN | PIN_DS_2 | PIN_SPC_EN));// GPIO_55 :
- CHIP_REG_OR(PIN_LCMD3_REG,( PIN_SLP_O | PIN_SPX_EN | PIN_SPO_X | PIN_FUNC_1 | PIN_FPX_EN | PIN_DS_2 | PIN_FPC_EN));// GPIO_56 :
- CHIP_REG_OR(PIN_LCMD5_REG,( PIN_SLP_Z | PIN_SPD_EN | PIN_SPO_X | PIN_FUNC_1 | PIN_FPD_EN | PIN_DS_1 | PIN_SPC_EN));// GPIO_58 :
- if ( spi_dev.handle != INVALID_SPI_HANDLE )
- {
- fd_spi_close(&spi_dev);
-
- spi_dev.handle = INVALID_SPI_HANDLE;
- }
- if ( !fd_spi_init(&spi_dev) )
- {
- fd_uart_printf("SPI总线创建失败\r\n");
- return FALSE;
- }
- else
- fd_uart_printf("SPI总线创建成功");
- //set txt mode
- spi_arg = SPI_TX_ONLY;
- SPI_HAL_Ioctl (SPI0_1_CS0, SPI_CTL_S_TRANSMODE, &spi_arg);
- spi_arg = SPI_CS_LOW;
- SPI_HAL_Ioctl(SPI0_1_CS0, SPI_CTL_S_CS, &spi_arg);
- SPI_HAL_Write(SPI0_1_CS0,&temp,1);
- spi_arg = SPI_CS_HIGH;
- SPI_HAL_Ioctl(SPI0_1_CS0, SPI_CTL_S_CS, &spi_arg);
- fd_spi_close(&spi_dev);
复制代码 |
|