找回密码
 立即注册

微信扫码登录

查看: 898|回复: 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

主题

10

回帖

54

积分

版主

积分
54
发表于 2026-5-7 15:13:50 | 显示全部楼层 来自 上海
Hello, how is the SPI I/O connected?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Telink forum ( 沪ICP备17008231号-1 )

GMT+8, 2026-8-16 17:12 , Processed in 0.090883 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表