Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Possible bug in ST7735_t3.cpp

  1. #1
    Junior Member
    Join Date
    Dec 2018
    Posts
    8

    Possible bug in ST7735_t3.cpp

    In this line

    Code:
          _pimxrt_spi->SR = 0x3f00; // clear out all of the other status...
    I wonder if Paul meant to mask out the bits, rather than setting all of the error condition bits.

    Code:
          _pimxrt_spi->SR &= 0x3f00; // clear out all of the other status...
    This isn't causing me any trouble, I just stumbled across it while learning about the Teensy 4.1 eDMA system. I'm not sure why you would want to explicitly set all of the error bits, but I can see how one might want to leave them as-is and reset the receive and transmit data flags...

    If it is an error: I think I may have seen the same code copy/pasted in some other LCD module somewhere as well but I'm not sure which.

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,352
    Note: if you look at the SR for the SPI in my pdf section 48.4.1.5 - page 2814

    Click image for larger version. 

Name:	screenshot.jpg 
Views:	16 
Size:	381.9 KB 
ID:	27291

    So this is actually clearing those bits out of the status register

  3. #3
    Junior Member
    Join Date
    Dec 2018
    Posts
    8
    I see it clearing the receive and transmit bits. But it's also setting all of the error condition bits. Is that intentional?

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,352
    Note the write line the bits are marked w1c which is writing a 1 in that bit will clear that bit on the hardware register

  5. #5
    Junior Member
    Join Date
    Dec 2018
    Posts
    8
    Got it, thanks for the clarification Kurt.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •