I haven't been around for a while but I recently started playing with PICs again. Anyway, I decided to substitute a PIC18F27K40 for a PIC18F2420 I was using for a project. I had a little difficulty with PPS but eventually got the program to work, at least up until the point where it reads from EEPROM. At that point, it just hangs and does nothing. If I comment out the lines using EPRead and EPWrite all is well.
P.S. I recently modified the SSD1331 driver for faster character writes and also added the graphic acceleration routines. I also made a working SSD1351 driver for those nice 128x128 full color OLED displays now available on eBay. I'll start another thread on those later but for now I want to see if this problem can be resolved. I even resorted to writing my own EPRead and EPWrite routines straight from the data sheet but it didn't fix the problem:
Can you create source code with the minimum code using the standard library that reproduces the issue? The code should be the minimum number of lines... nothing huge. Then, I have your baseline which I can test here.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That seems to work, which is weird. I didn't put EPWrite in the example code because the problem occurred at the first instance of EPRead. It also occurred when I commented out anything using EPRead but kept stuff in using EPWrite. Both seem to cause the program to fail.
It might be an issue with my chip configuration.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Question: How can I visually see if anything is working using that code?
I tried running my test program with no PPS assignments and software SPI. Same result. It hangs after EPRead. Evidently PSS isn't causing the problem.
I also tried running it with no config files, software SPI, and just the #chip PIC18F27K40 line. Same thing except it executes the first few commands in the second lamptest routine, but not the part where it writes characters. It looks like EPRead is changing something which keeps the print routines from working.
At least this is telling us EPRead (and probably EPWrite) aren't causing the chip to hang. They're just jamming up the GLCD routines in some way.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The root cause is the K40 itself. The errata shows the error regarding EEProm usage.
The fixes are: Update to EEPROM.H and an update to the compiler. The update caches the EEProm addressing bits - handled now with EEPROM.h and the interrupt handler.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
RESOLVED; See https://sourceforge.net/p/gcbasic/discussion/1073404/thread/a51df16ea3/#b58a The root cause in the K40 microcontroller.
I haven't been around for a while but I recently started playing with PICs again. Anyway, I decided to substitute a PIC18F27K40 for a PIC18F2420 I was using for a project. I had a little difficulty with PPS but eventually got the program to work, at least up until the point where it reads from EEPROM. At that point, it just hangs and does nothing. If I comment out the lines using EPRead and EPWrite all is well.
P.S. I recently modified the SSD1331 driver for faster character writes and also added the graphic acceleration routines. I also made a working SSD1351 driver for those nice 128x128 full color OLED displays now available on eBay. I'll start another thread on those later but for now I want to see if this problem can be resolved. I even resorted to writing my own EPRead and EPWrite routines straight from the data sheet but it didn't fix the problem:
Last edit: Anobium 2019-09-23
Crikey. ASM. That is serious.
K40 is pretty stable but versions of compiler please? Simply look at the top of the ASM file - this shows what I need.
0.98.<<>> 2017-12-21
I also tried it with the latest release ( 0.98.06 2019-06-12 (Windows 32 bit) ). Same issues.
Can you create source code with the minimum code using the standard library that reproduces the issue? The code should be the minimum number of lines... nothing huge. Then, I have your baseline which I can test here.
This is about as simple as I can get:
The program should go through the lamptest routine twice. It hangs after going through it once, which means the EPRead line is causing the problem.
Last edit: Joseph Realmuto 2019-09-23
I was thinking this. Does the work? Does the LED light/port go high?
And, I thought the issue is with EPwrite. Where is that in you example code? But, first does EPRead lock up?
I was thinking this. Does the work? Does the LED light/port go high?
And, I thought the issue is with EPwrite. Where is that in you example code? But, first does EPRead lock up?
That seems to work, which is weird. I didn't put EPWrite in the example code because the problem occurred at the first instance of EPRead. It also occurred when I commented out anything using EPRead but kept stuff in using EPWrite. Both seem to cause the program to fail.
It might be an issue with my chip configuration.
Yes, looks that way. Get rid of all the tweaks. Work thru from the code below to isolate the issue.
Question: How can I visually see if anything is working using that code?
I tried running my test program with no PPS assignments and software SPI. Same result. It hangs after EPRead. Evidently PSS isn't causing the problem.
I also tried running it with no config files, software SPI, and just the #chip PIC18F27K40 line. Same thing except it executes the first few commands in the second lamptest routine, but not the part where it writes characters. It looks like EPRead is changing something which keeps the print routines from working.
At least this is telling us EPRead (and probably EPWrite) aren't causing the chip to hang. They're just jamming up the GLCD routines in some way.
at rev of the chip do you have?
a002
I found this:
http://ww1.microchip.com/downloads/en/DeviceDoc/PIC18F27_47K40%20Errata%20DS80000713D.pdf
Look on page 4. That might be it.
Yes. but, we have already sorted that in initsys a while ago.
But, do investigate using the new .h file attached.
Just tried the new eeprom.h. Same thing. It looks like I might have to abandon the K40 for this particular project.
Send me the whole project. New glcds etc. It will be ok, hopefully.
Sent to your .anobium address.
The root cause is the K40 itself. The errata shows the error regarding EEProm usage.
The fixes are: Update to EEPROM.H and an update to the compiler. The update caches the EEProm addressing bits - handled now with EEPROM.h and the interrupt handler.