CYW20719: SPI TX issues

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

I am using the CYW20719 chip to power a SPI TFT screen. The screen is 160x128 with 2-byte pixels, and so I am tx-ing 160*128*2 = 40960 bytes of data over every 50ms. The code is fairly straightforward:

void set_addr(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {

    write_command(ST77XX_CASET);

    write_data(x0 >> 8);

    write_data(x0 & 0xFF);

    write_data(x1 >> 8);

    write_data(x1 & 0xFF);

    write_command(ST77XX_RASET);

    write_data(y0 >> 8);

    write_data(y0 & 0xFF);

    write_data(y1 >> 8);

    write_data(y1 & 0xFF);

    write_command(ST77XX_RAMWR);

}

//...

    set_addr(0, 0, width - 1, height - 1);

    set_high(DATA);

    set_low(CS);

    wiced_hal_pspi_tx_data(SPI1, width * height * 2, (uint8_t*) buffer);

    set_high(CS);

//...

However, I have noticed a bug in my program that causes one or both of my two periodic timers to stop timing out. When I comment out the above code, the device can run indefinitely, but when the code is not commented out, the device will freeze (timers stop) anywhere between 1 to 10 minutes after booting up.

My guess is that I am somehow overflowing the TX buffers. A similar bug had arisen where the device would crash completely unless I tx-ed the two halves of the screen buffer separately with a small delay between, which is why I believe buffers must be overflowing.

How can can I solve this issue? Can I increase the TX buffer size? Or alternatively, is there a better way to drive my screen?

Thank you,

Nicholas

0 Likes
1 Solution
Anonymous
Not applicable

Hello zhez​,

1. I have one 50ms timer and one 30s timer, both of which may fail randomly, so it is not necessarily the timer duration that is the problem.

2. I tried pushing 1024 bytes in each tx_data() call (the size of the tx buffer, from my understanding), but this does not solve the issue, it only extends the time before freezing.

3. Right now I use one-shot timers that I restart after each timeout, and this appears to solve the issue. However, it is not preferred as now I don't have control over how often my loop runs.

Nicholas

View solution in original post

0 Likes
4 Replies
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

Hi :

  from the description:

   I tx-ed the two halves of the screen buffer separately .   if this two halves tx  will cause the TFT lcd refresh has a obvious delay visually.

0 Likes
Anonymous
Not applicable

Hello zhez​,

Thank you for your response.

Yes drawing the two halves causes some small visual delays, but was only a (failed) solution to a previous problem, not the problem itself. The example was meant to show what I thought might be happening and why.

The problem is that line 27 of the above code causes my periodic timers to stop running, and commenting it out allows them to run indefinitely.

Thank you,

Nicholas

0 Likes

Hello:

    Can you help to do below tests ?

1.  increase the timer value to a bigger one like 1s .

2.  decrease the buffer to a small one like we only exchange one line of the screen.

3.  try to stop the timer and start the timer again after the spi data exchange.

thanks.

0 Likes
Anonymous
Not applicable

Hello zhez​,

1. I have one 50ms timer and one 30s timer, both of which may fail randomly, so it is not necessarily the timer duration that is the problem.

2. I tried pushing 1024 bytes in each tx_data() call (the size of the tx buffer, from my understanding), but this does not solve the issue, it only extends the time before freezing.

3. Right now I use one-shot timers that I restart after each timeout, and this appears to solve the issue. However, it is not preferred as now I don't have control over how often my loop runs.

Nicholas

0 Likes