MPLABxpress board EEprom doesn't work

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
chico
Posts: 34
Joined: Fri Dec 26, 2008 11:30 pm
Has thanked: 12 times
Been thanked: 10 times
Contact:

MPLABxpress board EEprom doesn't work

Post by chico »

Hi - I'm using the MPBLABxpress (16F18855) EEprom component provided in this thread:

viewtopic.php?f=64&t=19036&p=82573&hili ... ess#p82573

This device simulates fine in Flowcode and compiles in xc8, but when performing a "Compile to Chip" the hex file appears to load onto the board but doesn't execute on the board...no indication that the program is running (the first macro, the LCD initialization macro, doesn't execute).

I've added this component to a fully functioning MPLABxpress Flowcode program and the program fails to execute on the board after adding the component. I've attached a different simple Flowcode program which also exhibits this issue.

Can anybody with a MPLABxpress board verify this issue? Thanks...
Attachments
eeprom_test.fcfx
(13.03 KiB) Downloaded 209 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MPLABxpress board EEprom doesn't work

Post by Benj »

Hello,

I think I may have already come across and fixed the problem last week.

First you need the new device definition file. Place this into your "Flowcode 7/FCD/PIC" folder.
Microchip MPLABXpress.fcdx
(18.66 KiB) Downloaded 199 times
Then you will also need the updated CAL file. This needs to go into your "Flowcode 7/CAL/PIC" folder.
PIC_CAL_EEPROM.c
(4.65 KiB) Downloaded 219 times

chico
Posts: 34
Joined: Fri Dec 26, 2008 11:30 pm
Has thanked: 12 times
Been thanked: 10 times
Contact:

Re: MPLABxpress board EEprom doesn't work

Post by chico »

Hmmm...

Although the previous PIC_CAL_EEPROM.c file compiled ok, the new one fails to compile on my xc8 installation using the example program I provided:

Code: Select all

http://www.matrixtsl.com
Launching the compiler...
C:\Program Files\Flowcode 7\compilers\pic\bin\xc8.exe  --chip=16F18855 "eeprom_test.c" --MSGDISABLE=359,1273,1388
Microchip MPLAB XC8 C Compiler V1.41
Build date: Jan 24 2017
Part Support Version: 1.41
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration
eeprom_test.c: __PROG_CONFIG()
    28:	__PROG_CONFIG(0x1, 0x3F8C);
	              ^ (194) ")" expected
    29:	__PROG_CONFIG(0x2, 0x37FD);
	              ^ (194) ")" expected
    30:	__PROG_CONFIG(0x3, 0x3D8D);
	              ^ (194) ")" expected
    31:	__PROG_CONFIG(0x4, 0x1FFF);
	              ^ (194) ")" expected
    32:	__PROG_CONFIG(0x5, 0x3FFF);
	              ^ (194) ")" expected
(908) exit status = 1
(908) exit status = 1
C:\Program Files\Flowcode 7\compilers\pic\bin\xc8.exe reported error code 1

chico
Posts: 34
Joined: Fri Dec 26, 2008 11:30 pm
Has thanked: 12 times
Been thanked: 10 times
Contact:

Re: MPLABxpress board EEprom doesn't work

Post by chico »

More info: when I change the Project Options target to 16F18855 and set the config bits to the settings generated by the MPLABxpress target setting (see attached screenshot), the project compiles successfully but still will not run successfully after dragging the .hex file to the MPLABxpress virtual disk (the MPLABxpress red LED flashes indicating firmware load but successful operation does not occur).
Attachments
Screen Shot 2017-10-23 at 3.18.49 PM.JPG
Screen Shot 2017-10-23 at 3.18.49 PM.JPG (242.53 KiB) Viewed 6431 times

chico
Posts: 34
Joined: Fri Dec 26, 2008 11:30 pm
Has thanked: 12 times
Been thanked: 10 times
Contact:

Re: MPLABxpress board EEprom doesn't work

Post by chico »

I'm still trying to figure out why the files provided above cause compilation to fail....

Looking at the c file generated by using the MPLABxpress project option, which WON'T compile, I see this:

Code: Select all

unsigned char FCP_NULL = 0;

__PROG_CONFIG(0x1, 0x3F8C);
__PROG_CONFIG(0x2, 0x37FD);
__PROG_CONFIG(0x3, 0x3D8D);
__PROG_CONFIG(0x4, 0x1FFF);
__PROG_CONFIG(0x5, 0x3FFF);
#include <xc.h>
#include <math.h>
Note that the configuration bits come BEFORE the xc.h and math.h includes.

If I then change the project option chip to a 16F18855 (the chip on the MPLABxpress board), which DOES compile, the resulting C file changes to this:

Code: Select all

unsigned char FCP_NULL = 0;

#include <xc.h>
#include <math.h>

__PROG_CONFIG(0x1, 0x3FFF);
__PROG_CONFIG(0x2, 0x3FFF);
__PROG_CONFIG(0x3, 0x3F9F);
__PROG_CONFIG(0x4, 0x3FFF);
__PROG_CONFIG(0x5, 0x3FFF);
Note that the file that compiles correctly has the configuration bits AFTER the #includes.

The only other differences between the two C files are in the EEPROM EE types:

MPLABxpress: #define MX_EE_TYPE3

16F18855: #define MX_EE_TYPE4

...I don't know enough about the Flowcode stuff to say whether the above info is relevant or not, but thought I'd pass it along in case it's helpful...

chico
Posts: 34
Joined: Fri Dec 26, 2008 11:30 pm
Has thanked: 12 times
Been thanked: 10 times
Contact:

Re: MPLABxpress board EEprom doesn't work

Post by chico »

OK, I found that if I modify the revised "Microchip MPLABXpress.fcdx" file I can get the program to compile.

I changed these lines:

Code: Select all

    <defines code="__PROG_CONFIG(0x1, 0x3F8C);\n__PROG_CONFIG(0x2, 0x37FD);\n__PROG_CONFIG(0x3, 0x3D8D);\n__PROG_CONFIG(0x4, 0x1FFF);\n__PROG_CONFIG(0x5, 0x3FFF);\n\n" />
    <directives code="#include <xc.h>\n#include <math.h>\n\n" />
...to this line:

Code: Select all

   <directives code="#include <xc.h>\n#include <math.h>\n\n__PROG_CONFIG(0x1, 0x3F8C);\n__PROG_CONFIG(0x2, 0x37FD);\n__PROG_CONFIG(0x3, 0x3D8D);\n__PROG_CONFIG(0x4, 0x1FFF);\n__PROG_CONFIG(0x5, 0x3FFF);\n\n\n\n" />
...and it compiles. (I took a look at the Curiosity Board .fcdx file and saw how it was done there, borrowed the idea).

OK, so that is temporarily resolved. BUT...the EEProm routine still doesn't work. If I add a EEProm component without any calls to it, the program will run on the MPLABxpress board. But as soon as I make any calls to the EEProm component, the program fails to run...it won't even initialize the LCD, which occurs prior to the EEProm calls.

I've attached the revised program I'm using (the one above didn't properly initialize the LCD, which I didn't realize because the program wouldn't run...)

I'm still lost...would appreciate any assistance with this...thanks...
Attachments
eeprom_test_2.fcfx
(13.38 KiB) Downloaded 194 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MPLABxpress board EEprom doesn't work

Post by Benj »

Thanks for letting us know regarding the compiler issues and how you fixed them.

Regarding the EEPROM problem, please can you try this updated CAL file to see if this helps to solve the problem. It's working correctly on a 16F18877 device so hopefully it will also fix the problem on your device.

Simply copy the file to your "Flowcode 7/CAL/PIC" folder and then recompile the project to the chip.
PIC_CAL_EEPROM.c
(4.65 KiB) Downloaded 196 times

chico
Posts: 34
Joined: Fri Dec 26, 2008 11:30 pm
Has thanked: 12 times
Been thanked: 10 times
Contact:

Re: MPLABxpress board EEprom doesn't work

Post by chico »

Regarding the EEPROM problem, please can you try this updated CAL file to see if this helps to solve the problem. It's working correctly on a 16F18877 device so hopefully it will also fix the problem on your device.
Thanks Benj. But...it still refuses to function on the actual MPLABXpress hardware.

I had my MPLABXpress hardware connected to an I2C LCD...I thought perhaps there was a negative interaction with that, so I removed all I2C stuff and added a simple LED blink routine to provide operational feedback, using a built-in LED on the MPLABXpress board.

It simulates ok in Flowcode. I moved the C file to MPLABX and it simulates using the MPLABX simulator (I can step it through the full loop without hanging). But it refuses to run on the actual MPLABXpress hardware.

If the MPLABxpress board had an ICSP connector, I could step through commands on the 16F18855 with an ICD3. Adding an ICSP connector is an option as my last resort, but I was hoping you could first take a look and see if it fails on your hardware as well. It's possible I have a chip with faulty EEprom or something along those lines...

I've attached two Flowcode files: 1) A simple LED blink program without any EEprom calls to verify that the MPLABXpress bootloader is functioning. This program works fine on my hardware, LED blinks as expected. 2) The same Flowcode program with an added read and write call to the the Flowcode EEprom routine...and that program refuses to run on my MPLABXpress board, not even to blink the LED once, which is the first Flowcode statement before the EEprom calls occur.

I'd like to know if you are able to get the EEprom program to function on the MPLABxpress hardware...sorry to ask, I know how busy you must be...
Attachments
eeprom_test_without_EE.fcfx
(16.05 KiB) Downloaded 206 times
eeprom_test_with_EE.fcfx
(17.21 KiB) Downloaded 195 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MPLABxpress board EEprom doesn't work

Post by Benj »

Hello,

The problem seems to be when there is EEPROM data embedded in the hex file. Maybe the Xpress bootloader is handling it incorrectly. When programming a similar chip from the same family via a PICkit the problem seems to go away.

If you select the EEPROM component and delete the contents of the "Initial Values" property then hopefully it should then all work as expected.
MPLABXpress.fcfx
(8.77 KiB) Downloaded 202 times

chico
Posts: 34
Joined: Fri Dec 26, 2008 11:30 pm
Has thanked: 12 times
Been thanked: 10 times
Contact:

Re: MPLABxpress board EEprom doesn't work

Post by chico »

Ah, sweet success! You are absolutely right, clearing the preset EEprom values makes all of my test files function as they should.

And a workaround is a simple macro to re-populate the EEprom to initial values on first run after programming.

Thanks, Benj, much appreciated...

Post Reply