4 Replies Latest reply on Aug 21, 2018 8:41 AM by nicac_3523616

    CYW20719: SPI TX issues



      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_data(x0 >> 8);
          write_data(x0 & 0xFF);
          write_data(x1 >> 8);
          write_data(x1 & 0xFF);
          write_data(y0 >> 8);
          write_data(y0 & 0xFF);
          write_data(y1 >> 8);
          write_data(y1 & 0xFF);
          set_addr(0, 0, width - 1, height - 1);
          wiced_hal_pspi_tx_data(SPI1, width * height * 2, (uint8_t*) buffer);


      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,


        • 1. Re: CYW20719: SPI TX issues

          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.

          • 2. Re: CYW20719: SPI TX issues

            Hello ZhengbaoZ_96,


            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,


            • 3. Re: CYW20719: SPI TX issues


                  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.



              • 4. Re: CYW20719: SPI TX issues

                Hello ZhengbaoZ_96,


                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.