18F27K40 Silicon issue with rev a002 [Resolved].

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

Moderator: Benj

Post Reply
User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

18F27K40 Silicon issue with rev a002 [Resolved].

Post by medelec35 »

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
(113 KiB) Downloaded 1880 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.31 KiB) Downloaded 29 times
Martin

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

Lagoda
Posts: 153
Joined: Fri Jul 15, 2016 9:51 pm
Contact:

Re: 18F27K40 Silicon issue.

Post by Lagoda »

Hi Martin,

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

Code: Select all

asm ("BSF NVMCON1, 7");
Source:
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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 18F27K40 Silicon issue.

Post by medelec35 »

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: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 18F27K40 Silicon issue.

Post by medelec35 »

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: 153
Joined: Fri Jul 15, 2016 9:51 pm
Contact:

Re: 18F27K40 Silicon issue.

Post by Lagoda »

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 18F27K40 Silicon issue.

Post by medelec35 »

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: 2043
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: 18F27K40 Silicon issue.

Post by LeighM »

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 1925 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 18F27K40 Silicon issue.

Post by medelec35 »

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.
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: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 18F27K40 Silicon issue.

Post by medelec35 »

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.
Martin

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

User avatar
LeighM
Matrix Staff
Posts: 2043
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: 18F27K40 Silicon issue.

Post by LeighM »

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?

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 18F27K40 Silicon issue.

Post by medelec35 »

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: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 18F27K40 Silicon issue.

Post by medelec35 »

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
(20.58 KiB) Downloaded 1677 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: 14835
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: 18F27K40 Silicon issue.

Post by Benj »

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.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 18F27K40 Silicon issue.

Post by medelec35 »

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: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 18F27K40 Silicon issue.

Post by medelec35 »

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: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: 18F27K40 Silicon issue.

Post by medelec35 »

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.
Martin

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

User avatar
LeighM
Matrix Staff
Posts: 2043
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: 18F27K40 Silicon issue [Resolved].

Post by LeighM »

Ah! Well done :D

Post Reply