查看: 1308|回复: 1

[SPI] GSPI master read problem

[复制链接]

1

主题

0

回帖

17

积分

积分
17
发表于 2026-4-1 07:04:39 | 显示全部楼层 |阅读模式 来自 欧洲
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

主题

11

回帖

60

积分

积分
60
发表于 2026-5-7 15:13:50 | 显示全部楼层 来自 上海
Hello, how is the SPI I/O connected?

本版积分规则

关注公众号
隐私政策|Telink forum

相关侵权、举报、投诉及建议等,请发 E-mail:forum@telink-semi.com

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

在本版发帖返回顶部
公告×