18F27K40 Silicon issue with rev a002 [Resolved].

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

18F27K40 Silicon issue with rev a002 [Resolved].

Postby medelec35 » Thu Oct 17, 2019 3:42 pm

I have a developed a touch screen heating controller.
Development uses DIP version of 18F27K40 which has silicon rev a003 which works perfect.
Prototype production uses SMD but the silicon version is a002 which does not work perfect.
The touch screen uses SPI via FT810.
It can't be a PCB or other component fault as a lot of the touch display works.
The difference are Screen saver is on instantly instead of a 30-second delay.
Pass codes are not the same.
Using internal clock and same hex file on both silicon revisions.

The only thing I can see in the errata which may or may not affect the differences is:
2019_10_17_15_35_24_PIC18F27_47K40_Errata.png
2019_10_17_15_35_24_PIC18F27_47K40_Errata.png (113 KiB) Viewed 847 times


Is there a work around, assuming it is this issue and not an undocumented issue?

I can PM the project to a Matrix team member, If it will help?
Attachments
PIC18F27_47K40 Errata DS80000713D.pdf
(130.42 KiB) Downloaded 12 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Lagoda
Posts: 149
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 63 times
Been thanked: 59 times
Contact:

Re: 18F27K40 Silicon issue.

Postby Lagoda » Thu Oct 17, 2019 10:15 pm

Hi Martin,

Could you try this C code at the start of the program

Code: Select all

asm ("BSF NVMCON1, 7");

Source:
https://www.matrixtsl.com/mmforums/viewtopic.php?f=76&t=20479
Have you tried it before?
I used this solution for PIC18F67K40 MCU and it worked for me.

Best Regards,

Lagoda
These users thanked the author Lagoda for the post (total 2):
medelec35 (Fri Oct 18, 2019 5:05 am) • LeighM (Fri Oct 18, 2019 7:59 am)
Rating: 10.53%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: 18F27K40 Silicon issue.

Postby medelec35 » Fri Oct 18, 2019 5:11 am

Hi Lagoda,
Thank you for your reply.
It's worrying you had to switch in the end as that what I may need to do.
Hopefully it won't come to that.
I will try the solution you posted, and post an update a bit later this morning.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: 18F27K40 Silicon issue.

Postby medelec35 » Fri Oct 18, 2019 8:42 am

Hi Lagoda,
In my case it has not made any difference by adding a C code block with

Code: Select all

asm ("BSF NVMCON1, 7");

I appreciate the reply.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Lagoda
Posts: 149
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 63 times
Been thanked: 59 times
Contact:

Re: 18F27K40 Silicon issue.

Postby Lagoda » Fri Oct 18, 2019 10:24 am

Hi Martin,

Does your project file compiled into C language contain the TBLRD instruction?

I tested this silicone issue with a very simple program, because was a problem with string operations.
Unfortunately, I have little experience with this silicone bug.

Regards,

Lagoda
These users thanked the author Lagoda for the post:
medelec35 (Fri Oct 18, 2019 10:44 am)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: 18F27K40 Silicon issue.

Postby medelec35 » Fri Oct 18, 2019 10:44 am

I could not see TBLRD within the generated C code, but I do use strings.
I'm not sure if TBLRD is used under the hood or not?
Lagoda wrote:Unfortunately, I have little experience with this silicone bug.

Me neither.
Trouble is my project has a lot of functions and even using the professional version of XC8 compiler, uses 107609 bytes.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
LeighM
Matrix Staff
Posts: 1911
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 460 times
Been thanked: 646 times
Contact:

Re: 18F27K40 Silicon issue.

Postby LeighM » Fri Oct 18, 2019 11:11 am

Hi Martin,
My only recollections on this issue is that we had to do a fix (about a year ago) in the EEPROM component to explicitly reset the NVMREG access selection back to Flash after reading EEPROM.

Code: Select all

NVMCON1bits.NVMREG = 2;

This is done in the EEPROM CAL code.


NVMREG.jpg
NVMREG.jpg (65.35 KiB) Viewed 779 times
These users thanked the author LeighM for the post (total 2):
medelec35 (Fri Oct 18, 2019 11:59 am) • AbhijitR (Sat Oct 19, 2019 2:44 am)
Rating: 10.53%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: 18F27K40 Silicon issue.

Postby medelec35 » Fri Oct 18, 2019 1:11 pm

Thanks Leigh, I have opened a case with microchip.
If they are able to resolve this then I will post the solution within this topic.
These users thanked the author medelec35 for the post:
AbhijitR (Sat Oct 19, 2019 2:43 am)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: 18F27K40 Silicon issue.

Postby medelec35 » Mon Oct 21, 2019 9:37 am

After some debugging I have worked out why silicon a002 is not working and a003 is.
With a002 the initial value of all variables are being cleared to 0 ("" for strings), no matter what values set within flowchart.
These users thanked the author medelec35 for the post:
LeighM (Mon Oct 21, 2019 10:36 am)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
LeighM
Matrix Staff
Posts: 1911
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 460 times
Been thanked: 646 times
Contact:

Re: 18F27K40 Silicon issue.

Postby LeighM » Mon Oct 21, 2019 10:39 am

Ah! Well spotted!
... the (NVMREG) fix will need to go into the (Microchip compiler) startup code, hmm....

Does setting your string values in an icon after the NVMREG fix work OK?
These users thanked the author LeighM for the post:
medelec35 (Mon Oct 21, 2019 10:42 am)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: 18F27K40 Silicon issue.

Postby medelec35 » Mon Oct 21, 2019 12:15 pm

Hi Leigh,
Just to test, I have commented out the NVMREG fix and makes no difference.
Strings values are OK if set in calculation boxes.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: 18F27K40 Silicon issue.

Postby medelec35 » Fri Oct 25, 2019 1:31 pm

I have had a reply from Microchip on this,
In order to see how to call the powerup.as file you can do a small test.

For example, if you generate an empty project in MPLABX, with only while(1); loop in main and include the powerup.as file, you can build the project and see what you have to call in the output window.
Powerup.as.png
Powerup.as.png (20.58 KiB) Viewed 644 times

For example on my side the compiling and linking path look like this:

"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -c -mcpu=18F45K40 -fno-short-double -fno-short-float -memi=wordwrite -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/powerup.o powerup.as

"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F45K40 -Wl,-Map=dist/default/production/PIC18F45K40.X.production.map -DXPRJ_default=default -Wl,--defsym=__MPLAB_BUILD=1 -fno-short-double -fno-short-float -memi=wordwrite -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -Wl,--memorysummary,dist/default/production/memoryfile.xml -o dist/default/production/PIC18F45K40.X.production.elf build/default/production/main.p1 build/default/production/powerup.o



If you do not manage to get it working, I think the solution is to ask the Flowcode guys how to have this file included.

So my question is How is the powerup.as added and included?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: 18F27K40 Silicon issue.

Postby Benj » Fri Oct 25, 2019 2:44 pm

Hi Martin,

It looks to me like it is added to the end of the compiler parameters probably inside the batch file.

So this line in the batch file "C:\Program Files (x86)\Flowcode\Common\Compilers\pic\batch\pic_xc8_comp.bat".

Code: Select all

%~dp0..\bin\xc8.exe --chip=%~1  "%~3.c" --MSGDISABLE=359,1273,1388 --FLOAT=32 --DOUBLE=32


The change might look something like this.

Code: Select all

%~dp0..\bin\xc8.exe --chip=%~1  "%~3.c" --MSGDISABLE=359,1273,1388 --FLOAT=32 --DOUBLE=32 C:\FC\powerup.as


You might also need to add the powerup.o to the parameters for the linker.
These users thanked the author Benj for the post:
medelec35 (Fri Oct 25, 2019 3:30 pm)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: 18F27K40 Silicon issue.

Postby medelec35 » Fri Oct 25, 2019 3:31 pm

Thanks Ben.
Won't be able to test until Monday.
Once tested, will let you know the results.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: 18F27K40 Silicon issue.

Postby medelec35 » Mon Oct 28, 2019 4:39 pm

Hi Ben.
All the steps I have taken.
1. Named a directory to FC on the root drive.
2. Placed within the FCdirectory a file called powerup.as

Contents of powerup.as:

Code: Select all

#include <xc.inc>
GLOBAL powerup, start
PSECT powerup, class=CODE, delta=1,
reloc=2
powerup:
BSF NVMCON1, 7
GOTO start
end


3. Modifed batch file to:

Code: Select all

@REM $(chip) "$(outdir)" "$(target)"
@PUSHD %~2
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=%~1 "%~3.c" -w=359,1273,1388 -fshort-float -fshort-double -std=c90 -Os C:\FC\powerup.as
@POPD
@IF %ERRORLEVEL% NEQ 0 GOTO Error
@ECHO.
@ECHO Compilation successful!
@EXIT 0
:Error
@ECHO.
@ECHO Error returned from [xc8.exe]
@EXIT 1


Flowcode has a compiling error with the powerup.as:

Code: Select all

Launching the compiler...

C:\Program Files (x86)\Flowcode\Compilers\pic\batch\pic_xc8 V2.05_comp 18F27K40 Only.bat 18F27K40 "M:\New Temperature controller\Software Dev\Controller\" "Heat Control Beta13Test silicon only"



M:\New Temperature controller\Software Dev\Controller>"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F27K40 "Heat Control Beta13Test silicon only.c" -w=359,1273,1388 -fshort-float -fshort-double -std=c90 -Os C:\FC\powerup.as

. . . . . . . . . . . . . . . . . . . . .



powerup.i:15561:: error: (876) syntax error

(908) exit status = 1



Error returned from [xc8.exe]



C:\Program Files (x86)\Flowcode\Compilers\pic\batch\pic_xc8 V2.05_comp 18F27K40 Only.bat reported error code 1
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: 18F27K40 Silicon issue.

Postby medelec35 » Tue Oct 29, 2019 1:55 pm

Update,
After changing:

Code: Select all

#include <xc.inc>
GLOBAL powerup, start
PSECT powerup, class=CODE, delta=1,
reloc=2
powerup:
BSF NVMCON1, 7
GOTO start
end

To

Code: Select all

#include <xc.inc>
GLOBAL powerup, start
PSECT powerup, class=CODE, delta=1, reloc=2
powerup:
BSF NVMCON1, 7
GOTO start
end

Flowcode compiles and hardware works as expected I.e variables can now be preassigned.

Thank you for your help with this silicon issue.
These users thanked the author medelec35 for the post (total 3):
LeighM (Tue Oct 29, 2019 2:25 pm) • Lagoda (Wed Oct 30, 2019 6:19 am) • Benj (Mon Nov 04, 2019 6:14 pm)
Rating: 15.79%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
LeighM
Matrix Staff
Posts: 1911
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 460 times
Been thanked: 646 times
Contact:

Re: 18F27K40 Silicon issue [Resolved].

Postby LeighM » Tue Oct 29, 2019 2:26 pm

Ah! Well done :D
These users thanked the author LeighM for the post:
medelec35 (Wed Oct 30, 2019 8:59 am)
Rating: 5.26%