Hello! It seems these issues only happen to me since I use odd PICs lol. But this is the beginning of a larger program so I only have the basics in so far and as you can tell, this is just to get things going. I have not moved the pins via PPS yet, but I dont think that matters. Code is included.
The error is coming from with the GLCD library. There is a clear screen routine that is intended to be very quick... but, on the later chips it does not work as the SPI is very different.
Please try the attached - I have updated to handle the new chips with the latest SPI module.
Also, please restart/update GCStudio to get build 1226.
Updating and using the dev version, along with copying that file allowed it to compile with no errors. I should hopefully be able to do a hardware test within a few days to see if it works. I tried it on the 18F15Q41 but I'll try to compile on the other chip just to make sure it works :) I'll keep this thread open just to make sure I dont run into any thing.
Thanks :)
Last edit: Chris S 2023-03-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Turns out, it wasnt :). I had limited time between today and last night but I think I may know where to look:
SPI Data/clock dont seem to be working, however, DC and RST seem to have things going on per my scope. Theres definitely a clock signal of sorts going on there.
-Verified that all pins are connected physically. Used a meter to do this and ohm checked everything. I had to change the PIC to the one currently being used.
-Verified the physical layout to the GLCD is correct.
-Double checked PPS. Double checked the datasheet for any conflicting pins.Maybe Its worth triple checking. Will post schematic down below
-I am using the PICKIT3 to power the thing-its only the GLCD and PIC. Nothing else. I am using 3.3V.
-I have tried two ILI9486 modules so far with no luck. Unless they are both "bad"
Suspicions: -Check PPS, and SPI modules against the datasheet. Something isnt sending data. When I get home I'll have to try just sending raw data over and over (so just do a SPI transfer) to verify where the problem is.
-Checking the GLCD lib's arent my forte so I can only go so far.
Also trimmed down the code a lot. Included it here.
Tried removing the PPS and I did get SPI (software) to work and I saw a clock signal, but no dice on the GLCD.
Tried your above changes, and still no dice. However, Something bugs me: Clock, DC and RST are all around VCC(peak). SDO is around 1V(peak). Im not sure why this is. It only happens when I connect the GLCD. Without it, I see the signals at the proper levels. Im using the PICs 3.3V supply, which should be enough for this.
Is it possible I have two defective modules? Or Maybe they arent an legit modules?
did buy an IL9488 module. I could try that as a last resort...
I also DID try another pic in software mode: 18F13K22. Still nothing on that one too..
For clarity: via my scope it does look like SPI is working proper. I just mean there is a clock signal but it only goes up to 1V peak on the SDO line.
Thanks for the help so far.
Last edit: Chris S 2023-03-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK. Disconnect the GLCD. Let us get back to basics.
This is a test program. It will send data on GLCD_DO, GLCD_SCK, GLCD_CS and GLCD_DC. Test with ILI9486L_HardwareSPI and with ILI9486L_HardwareSPI commented out.
Note: The PPS turns on and off the assignments. If you were testing and failed to power cycle between PPS and non-PPS then the PPS assignments would not change which would disable the use of the port).
So, test both cases. Do you signals on the lines?
#chip 18F26K83#include<glcd.h>#DEFINE GLCD_TYPE GLCD_TYPE_ILI9486#define GLCD_DC PORTB.3 ' Data command line#define GLCD_CS PORTB.5 ' Chip select line#define GLCD_RST PORTB.4 ' Reset line#define GLCD_DI PORTB.2 ' Data in | MISO#define GLCD_DO PORTB.0 ' Data out | MOSI#define GLCD_SCK PORTB.1 ' Clock Line#startup InitPPS, 85#define PPSToolPart 18f26k83SubInitPPS#IFDEF ILI9486L_HardwareSPIUNLOCKPPSRB0PPS=0x001F'SDO1>RB0RB1PPS=0x001E'SCK1>RB1SPI1SCKPPS=0x0009'RB1>SCK1(bi-directional)SPI1SDIPPS=0x000A'RB2>SDI1LOCKPPS#ELSERB1PPS=0RB0PPS=0#ENDIF EndSub// Template comment at the end of the config file// #define ILI9486L_HardwareSPIdoSendCommand_ILI9486L(0x55)SendData_ILI9486L(0x55)loop
Re the product. I have not seen one of these. If this continues to be an issue - send me one.
Of the ILI9486 (l) I have here. All have one thing in common. 5v0 supply but all the lines are 3v3. And, I some products here I have build a voltage level board. See point 10 in the table listing on AliExpress!
I am confident that the SPI works. So, we keep investigating. :-)
Last edit: Anobium 2023-03-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So, what your saying is, even though I have the PICkit3 set for 3.3V, I have to power VCC of the LCD separately at 5V but the logic levels have to be at 3.3V?
I am going to try that out before I do a PCB revision, but it will be with another PIC since I dont have the DIP version of that IC.
Thirdly, do we have a list of confirmed and working GLCDs? I picked this one out because it should be supported.
Last edit: Chris S 2023-03-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
re 5v0 and 3v3. I have tested and validated on three similar GLCDs. They all have 5v0 supply and 3v3 logic. And, I have written this on the GLCD to remind me. So, you can run at 3v3 for logic but power the supply at 5v0.
The list of supported GLCDs is in the Help. The Help can always be improved to cover this specific voltage issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I see there is a jumper on the back that can be soldered for 3.3V so I went home on my lunch to give it a shot. Used latest above and tried to change the background to purple and still nothing. The screen does go to black/grey though, rather than the usual "white".
The only reason I ask about the GLCDs is so I can get the GLCD you are testing with. I kind of already built my platform around this screen, so its just a matter of getting it to work.
I do also wonder if this is a ILI9488 and not an 86.
Edit: IIRC we went through this before and I think the only other screen I have that is working is the 2.4" or 1.8". I'll have to check when I get home.
Last edit: Chris S 2023-03-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK So good news! the ILI9341 works! So thats progress. Changes: swapped RB0 and RB2. So at least we have a starting point. Funny enough, when I had the OLD code in for the ILI9486...this screen worked. Going to test the other one next..
#chip 18F26K83#include<glcd.h>#define GLCD_TYPE GLCD_TYPE_ILI9341#define GLCD_DC PORTB.3 ' Data command line#define GLCD_CS PORTB.5 ' Chip select line#define GLCD_RESET PORTB.4 ' Reset line#define GLCD_DI PORTB.0 ' Data OUT | MOSI#define GLCD_DO PORTB.2 ' Data IN | MISO#define GLCD_SCK PORTB.1 ' Clock Line#startup InitPPS, 85#define PPSToolPart 18f26k83SubInitPPS#IFDEF ILI9341_HardwareSPIUNLOCKPPSRB2PPS=0x001F'SDO1>RB0RB1PPS=0x001E'SCK1>RB1SPI1SCKPPS=0x0009'RB1>SCK1(bi-directional)//SPI1SDIPPS = 0x000A 'RB2 > SDI1LOCKPPS#ELSERB1PPS=0RB0PPS=0#ENDIFEndSub// Template comment at the end of the config file#define ILI9341_HardwareSPIGLCDBackground=TFT_PURPLEGLCDRotate(Landscape)GLCDfntDefaultSize=3do//GLCDBackground=TFT_NAVYGLCDPrint(10,10,"Test of the ILI9486L Device")GLCDPrint(30,30,"3/23/2023",TFT_RED)RoundRect(40,40,80,80,TFT_GREEN)loop
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello! It seems these issues only happen to me since I use odd PICs lol. But this is the beginning of a larger program so I only have the basics in so far and as you can tell, this is just to get things going. I have not moved the pins via PPS yet, but I dont think that matters. Code is included.
The error I get is this:
PIC: 18F15Q41
Also gives the same error with PIC18F26K83
The error will go away if I comment out the GLCD print line or the GLCDCLS line and it will compile fine.
If I just use the ASM button, it will compile to ASM. But if I try to use the HEX button, I get the above errors
Last edit: Chris S 2023-03-21
ERRORS.txt
The error is coming from with the GLCD library. There is a clear screen routine that is intended to be very quick... but, on the later chips it does not work as the SPI is very different.
Please try the attached - I have updated to handle the new chips with the latest SPI module.
Also, please restart/update GCStudio to get build 1226.
Updating and using the dev version, along with copying that file allowed it to compile with no errors. I should hopefully be able to do a hardware test within a few days to see if it works. I tried it on the 18F15Q41 but I'll try to compile on the other chip just to make sure it works :) I'll keep this thread open just to make sure I dont run into any thing.
Thanks :)
Last edit: Chris S 2023-03-21
And, a great post. So, easy to understand. :-) Thank you.
It should be ok but you never know!
Turns out, it wasnt :). I had limited time between today and last night but I think I may know where to look:
SPI Data/clock dont seem to be working, however, DC and RST seem to have things going on per my scope. Theres definitely a clock signal of sorts going on there.
-Verified that all pins are connected physically. Used a meter to do this and ohm checked everything. I had to change the PIC to the one currently being used.
-Verified the physical layout to the GLCD is correct.
-Double checked PPS. Double checked the datasheet for any conflicting pins.Maybe Its worth triple checking. Will post schematic down below
-I am using the PICKIT3 to power the thing-its only the GLCD and PIC. Nothing else. I am using 3.3V.
-I have tried two ILI9486 modules so far with no luck. Unless they are both "bad"
Suspicions: -Check PPS, and SPI modules against the datasheet. Something isnt sending data. When I get home I'll have to try just sending raw data over and over (so just do a SPI transfer) to verify where the problem is.
-Checking the GLCD lib's arent my forte so I can only go so far.
Also trimmed down the code a lot. Included it here.
PIC Side:
Last edit: Chris S 2023-03-22
Board Side
ok. Rule out PPS. Remove the PPS statements, then, the remove/comment out the hardware SPI. This will then use software SPI. Test.
I have just checked/inpsected the demo (what are also the test programs) and this specific configuration has not been tested - PIC18F26K83
The 18F15Q41 has been veified with SPI&GLCD.
We will need work this thru.
Please use the two files attached. Test.
Tried removing the PPS and I did get SPI (software) to work and I saw a clock signal, but no dice on the GLCD.
Tried your above changes, and still no dice. However, Something bugs me: Clock, DC and RST are all around VCC(peak). SDO is around 1V(peak). Im not sure why this is. It only happens when I connect the GLCD. Without it, I see the signals at the proper levels. Im using the PICs 3.3V supply, which should be enough for this.
Is it possible I have two defective modules? Or Maybe they arent an legit modules?
did buy an IL9488 module. I could try that as a last resort...
I also DID try another pic in software mode: 18F13K22. Still nothing on that one too..
For clarity: via my scope it does look like SPI is working proper. I just mean there is a clock signal but it only goes up to 1V peak on the SDO line.
Thanks for the help so far.
Last edit: Chris S 2023-03-22
Also link to the GLCD I bought:
https://www.aliexpress.us/item/3256804419100652.html?spm=a2g0o.order_list.order_list_main.12.21ef1802ZCxuoM&gatewayAdapt=glo2usa&_randl_shipto=US
Stupid question, but could I be mis-interpreting SDI and SDO?I guess what Im saying is, RB2 might be Master Out Serial In.
Edit-Thats what it was. The levels are proper now. Still no GLCD though.
Last edit: Chris S 2023-03-22
OK. Disconnect the GLCD. Let us get back to basics.
This is a test program. It will send data on GLCD_DO, GLCD_SCK, GLCD_CS and GLCD_DC. Test with
ILI9486L_HardwareSPI
and withILI9486L_HardwareSPI
commented out.Note: The PPS turns on and off the assignments. If you were testing and failed to power cycle between PPS and non-PPS then the PPS assignments would not change which would disable the use of the port).
So, test both cases. Do you signals on the lines?
Re the product. I have not seen one of these. If this continues to be an issue - send me one.
Of the ILI9486 (l) I have here. All have one thing in common. 5v0 supply but all the lines are 3v3. And, I some products here I have build a voltage level board. See point 10 in the table listing on AliExpress!
I am confident that the SPI works. So, we keep investigating. :-)
Last edit: Anobium 2023-03-23
Yes.
If you have signals using HWSPI and SWSPI then we know that SPI is good.
You need to add the 3v3 levelers.
So, what your saying is, even though I have the PICkit3 set for 3.3V, I have to power VCC of the LCD separately at 5V but the logic levels have to be at 3.3V?
I am going to try that out before I do a PCB revision, but it will be with another PIC since I dont have the DIP version of that IC.
Thirdly, do we have a list of confirmed and working GLCDs? I picked this one out because it should be supported.
Last edit: Chris S 2023-03-23
re 5v0 and 3v3. I have tested and validated on three similar GLCDs. They all have 5v0 supply and 3v3 logic. And, I have written this on the GLCD to remind me. So, you can run at 3v3 for logic but power the supply at 5v0.
The list of supported GLCDs is in the Help. The Help can always be improved to cover this specific voltage issue.
Well, I see there is a jumper on the back that can be soldered for 3.3V so I went home on my lunch to give it a shot. Used latest above and tried to change the background to purple and still nothing. The screen does go to black/grey though, rather than the usual "white".
The only reason I ask about the GLCDs is so I can get the GLCD you are testing with. I kind of already built my platform around this screen, so its just a matter of getting it to work.
I do also wonder if this is a ILI9488 and not an 86.
Edit: IIRC we went through this before and I think the only other screen I have that is working is the 2.4" or 1.8". I'll have to check when I get home.
Last edit: Chris S 2023-03-23
Next Tuesday, I will test here. I have your chip.
You can try the other 86 library. No harm in trying.
re the GLCDs. Look at the demos. Those have all been tested. It is a good way to show all the chips and GLCDs.
Unfortunately, Demo's is empty. Is it supposed to be that way? I can still pull from an older version though
Yes. We move the demos out into a separate installer. That was to reduce the installer size.
See https://sourceforge.net/projects/gcbasic/files/GCStudio%20-%20Complete%20IDE%20and%20Toolchain%20for%20Windows/
OK So good news! the ILI9341 works! So thats progress. Changes: swapped RB0 and RB2. So at least we have a starting point. Funny enough, when I had the OLD code in for the ILI9486...this screen worked. Going to test the other one next..