View: 1565|Reply: 1

[SPI] GSPI master read problem

[复制链接]

1

主题

0

回帖

17

积分

积分
17
Posted on 2026-4-1 07:04:39 | Show all posts |Reading mode 来自 欧洲
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

SPI Exchange

0

主题

12

回帖

68

积分

积分
68
Posted on 2026-5-7 15:13:50 | Show all posts 来自 上海
Hello, how is the SPI I/O connected?

本版积分规则

Follow our WeChat
Privacy Policy|Telink Developer Community

For copyright infringement reports, complaints or suggestions, please email forum@telink-semi.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|沪ICP备17008231号-1 |沪公网安备31011502403548号

inThis forumPostBack to top