Hi All,
I am trying to read data from SD card then write them into LCD.
For that I am reading the data to buffer of 8K bytes then write them to the LCD. It works fine but sometime there is error of:
spi_master: check_trans_valid(811): trans tx_buffer should be NULL and SPI_TRANS_USE_TXDATA should be cleared to skip MOSI phase
specially with large files. Tryed using 215, 512, .. buffer size but always getting this error! also, tried adding delay but still same.
can anyone help please?
The code is :
void startTrans(U32 addr , U8 cmd)
{
esp_err_t ret;
spi_transaction_t tx;
memset(&tx, 0, sizeof(tx));
U8 len = 0;
U32_t tr;
tr.u32 = 0;
switch (cmd)
{
case 0:
len = 32;
break;
case 1:
case 2:
len = 24;
break;
}
tr.u8[0] = (U8)((addr >> 16) | (U8)(cmd << 6));
tr.u8[1] = (U8)(addr >> 8);
tr.u8[2] = (U8)(addr & 0xFF);
tx.length = len;
tx.rx_buffer = NULL;
tx.tx_buffer = (U8*)&tr.u32;
ret = spi_device_transmit(FT_spi , &tx);
assert(ret==ESP_OK);
//delay_us(3);
}
void Write(U32 addr, U8 *Src, U32 NBytes)
{
esp_err_t ret;
spi_transaction_t tx;
memset(&tx, 0, sizeof(tx));
gpio_set_level(FT_CS, 0);
startTrans(addr & 0x3FFFFF,cmd_wr);
tx.length = NBytes * 8;
tx.rx_buffer = NULL;
tx.tx_buffer = Src;
ret = spi_device_transmit(FT_spi , &tx);
assert(ret==ESP_OK);
//delay_us(NBytes*2);
gpio_set_level(FT_CS, 1);
}
Using SPI master to send large amount of data
-
- Posts: 9040
- Joined: Thu Nov 26, 2015 4:08 am
Re: Using SPI master to send large amount of data
Are you sure you can never have a situation where NBytes is 0?
Re: Using SPI master to send large amount of data
Thank you ,
I am not sure! could that be the problem?
I am not sure! could that be the problem?
-
- Posts: 9040
- Joined: Thu Nov 26, 2015 4:08 am
Re: Using SPI master to send large amount of data
That is the most likely scenario that would trigger that error message, so I'd say so.
Re: Using SPI master to send large amount of data
Many thanks, that was the problem
Who is online
Users browsing this forum: antonjung, ESP_Roland, Google Adsense [Bot] and 145 guests