|
|
Information
| 说明: |
建议参照本版块置顶帖内容输入必要信息 |
| 芯片型号: |
TL7218A |
| 驱动SDK版本: |
tl platform SDK 3.9.0 |
本帖最后由 Eugene 于 2026-4-1 13:55 编辑
Please help me.
I want to use the spi_master_read function. My code:
gspi_pin_config_t gspi_pin_config =
{
.spi_clk_pin = GPIO_PA2,
.spi_csn_pin = GPIO_NONE_PIN,
.spi_mosi_io0_pin = GPIO_PA3,
.spi_miso_io1_pin = GPIO_PA4,
.spi_io2_pin = GPIO_NONE_PIN,
.spi_io3_pin = GPIO_NONE_PIN
};
uint8_t buffer[12];
...
// SPI init section
spi_master_init(GSPI_MODULE, sys_clk.pll_clk * 1000000 / 1000000, SPI_MODE3);
gspi_set_pin(&gspi_pin_config);
spi_master_config(GSPI_MODULE, SPI_3LINE);
spi_set_io_mode(GSPI_MODULE, SPI_3_LINE_MODE);
...
// SPI exchange section
gpio_set_low_level(GSPI_CS);
delay_us(100); // slave need delay
spi_master_read(GSPI_MODULE, buffer, sizeof(buffer));
spi_master_write(GSPI_MODULE, buffer, sizeof(buffer)); // test only
gpio_set_high_level(GSPI_CS);
I expect to see on MOSI during transmission what I see on MISO during reception. But this is not the case, only the first byte is received.
This can be seen in the screenshot. This can be seen in the screenshot
|
-
SPI Exchange
|