Author Topic: PIC18F26K40 memory access bug  (Read 2040 times)

0 Members and 1 Guest are viewing this topic.

Offline 0b01010011Topic starter

  • Regular Contributor
  • *
  • Posts: 69
  • Country: au
PIC18F26K40 memory access bug
« on: January 05, 2017, 09:34:15 pm »
Not sure this is well documented on the web, but I had some fun with the PIC18F26K40 recently - basically anything using/accessing constants, such as a const int, or a const char array (an inline string for example) was not returning the valid content of the constant.

I put this down to my primitive embedded skills at first, but it turns out there is a bug in this particular PIC (and the 27K40 according to others) that means without setting some register at powerup, the PIC fails to successfully return values from program memory reads.

My experience was with a inline string (which was defined as const char xx[] = "XXX") and with a const int.  In my experience the string was full of NULs, and the int was 0, regardless of what the code said.

Here is the errata (see section 3):
http://ww1.microchip.com/downloads/en/DeviceDoc/80000712A.pdf

And here is step-by-step way to implement the workaround in MPLABX:
http://www.microchip.com/forums/FindPost/957920

Apparently this workaround is implemented automatically in XC8 1.40 but I have not tested this.  The workaround does work and the PIC behaves fine now.
 
The following users thanked this post: garethw

Offline tommy_tom2000

  • Newbie
  • Posts: 1
  • Country: au
Re: PIC18F26K40 memory access bug
« Reply #1 on: May 27, 2019, 02:05:25 pm »
Wow I have been been struggling to get my font array working for hours before I found this post. Thanks for the heads up!
Can confirm that the workarround works fine.

Tommy
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf