If I use it with a circuit that uses both SPI and I2C I have problems. In the below program the first three " GLCDPrint" statements work correctly. After they print on the GLCD screen, the screen turns white and stays white.
Subsequent " GLCDPrint" commands do not work. When I connect an oscilloscope to the SPI SCK (portD.7) and SPI DO (portC.7) ports I see clock and data pulses being sent whenever I press any of the switches.
Is GCB able to switch back and forth between I2C and SPI commands? If so what am I doing wrong?
Yes, HWI2C is working. In my original program there was more code and the "IF" statements were bigger. I changed them in the version I sent you to reduce the confusion. (the version I sent you has the same problem as the longer version)
Here is what was after the HI2C READ. (All of this worked except the "GLCDPrint" statements.
locate 0, 0
print Fourth_Byte
print " "
print ByteToBin(Fourth_Byte)
locate 1, 0
print Third_Byte
print " "
print ByteToBin(Third_Byte)
locate 2, 0
print Button_XYS
print " "
print ByteToBin(Button_XYS)
locate 3, 0
print Button_AB
print " "
print ByteToBin(Button_AB)
locate 0, 14
If Button_XYS.1 = 0 then
print "B"
GLCDPrint(4, 10, "Button B", TFT_RED )
End If
If Button_XYS.2 = 0 then
print "A"
GLCDPrint(4, 0, "Button A", TFT_YELLOW )
End If
If Button_XYS.3 = 0 then
print "S" ;Push for Select
GLCDPrint(4, 60, "SELECT", TFT_RED )
End If
If Button_AB.2 = 0 then
print "U"
GLCDPrint(4, 20, "UP", TFT_RED )
End If
If Button_AB.3 = 0 then
print "L"
GLCDPrint(4, 30, "LEFT", TFT_RED )
End If
If Button_AB.4 = 0 then
print "D"
GLCDPrint(4, 40, "DOWN", TFT_RED )
End If
If Button_AB.7 = 0 then
print "R"
GLCDPrint(4, 50, "RIGHT", TFT_RED )
End If
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I figured out most of this problem. The GLCD_RESET does not go directly to the GLCD. It goes to Pin 7 of the ATSAMD09D14A-MU chip that is on the GLCD board. Pin 7 which is labeled TFT_RST is an active low. I changed the HI2CSend 207 to HI2CSend 206. This puts a low on pin 7.
Now all the switches cause a read out on the display EXCEPT Button B which causes the display to go white and stay white even when other buttons are pressed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using this GLCD: https://learn.adafruit.com/adafruit-mini-tft-featherwing
It is an ST7735R which uses SPI. When I use software with only SPI commands in it everything works great.
If I use it with a circuit that uses both SPI and I2C I have problems. In the below program the first three " GLCDPrint" statements work correctly. After they print on the GLCD screen, the screen turns white and stays white.
Subsequent " GLCDPrint" commands do not work. When I connect an oscilloscope to the SPI SCK (portD.7) and SPI DO (portC.7) ports I see clock and data pulses being sent whenever I press any of the switches.
Is GCB able to switch back and forth between I2C and SPI commands? If so what am I doing wrong?
Last edit: Anobium 2019-12-01
Is this using the new library I provided?
Please put the project in a ZIP. I will delete the .h posts. It will confuse readers.
I need the ST7735 (two files) also.
The code
Here
Have you confirmed the HWI2C works? Output the i2C discover to a serial terminal not the GLCD.
Did you check I2C discovery? First rule of I2C - is test with I2C discovery.
There is nothing obvious in the code. So, I would be check oit I2C discovery.
Yes, HWI2C is working. In my original program there was more code and the "IF" statements were bigger. I changed them in the version I sent you to reduce the confusion. (the version I sent you has the same problem as the longer version)
Here is what was after the HI2C READ. (All of this worked except the "GLCDPrint" statements.
I figured out most of this problem. The GLCD_RESET does not go directly to the GLCD. It goes to Pin 7 of the ATSAMD09D14A-MU chip that is on the GLCD board. Pin 7 which is labeled TFT_RST is an active low. I changed the HI2CSend 207 to HI2CSend 206. This puts a low on pin 7.
Now all the switches cause a read out on the display EXCEPT Button B which causes the display to go white and stay white even when other buttons are pressed.
It sounds like you are getting there.
:=)