Configuring EEPROM in Kinetis KE18

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configuring EEPROM in Kinetis KE18

Jump to solution
3,836 Views
CEPL_Dev
Contributor III
I was trying to configure the Flash module of MKE18F512VLL16 MCU to be used as an EEPROM.
 
I followed the attached application note from NXP "How to use FlexMemory as D-Flash and EEPROM in KE1xF" along with the datasheet as reference.
 
I encountered a question when I was studying the FTFE flash module. Here in MKE1x, Flash Common Command Object Registers (FTFE_FCCOBn) is used to write commands to be executed by the memory controller. The register structure is as follows, (command - Flash Address - Data Bytes).
 
Here according to the datasheet, the register will take only 24 bits of data for Flash Address argument while the MCU has a 32 bit addressing scheme. This confused me. How do I write a command to erase/program a specific region with a 32 bit address while my register will allow me to write only 24 bits?
 
Keeping this question aside, I tried to study the FlexNVM EEPROM example (attached here) from NXP for the MKE18 controller, but I was unable to extract relevant read and write functions by solving the dependencies from the company provided SDK.
 
I'm using Keil IDE for development. No RTOS - bare metal project.
 
The following is the operation sequence which I was trying.
 

 

 

#include "MKE18F16.h"                   // Device header
uint32_t read_data = 0;
uint32_t targetadd = 0;

void FlashInit(void){
    PCC->PCC_FLASH |= PCC_PCC_FLASH_CGC_MASK;   /* Enable clock for flash */
    FTFE->FSTAT = 0x30;     /* Clear error flags */
    FTFE->FCCOB0 = 0x81;    /* Set FlexRam function to EEPROM */
    FTFE->FCCOB1 = 0x00;    
    FTFE->FSTAT = 0x80;     /* Launch Flash Command */
    while (!(FTFE->FSTAT & FTFE_FSTAT_CCIF_MASK)); /* Wait untill command is completed */
}

void FlashEraseSector(uint32_t TargetAddress){
    FTFE->FSTAT  = 0x30; /* Clear Error Flags*/
    FTFE->FCCOB0 = 0x09; /* Flash Erase Sector Command */
    FTFE->FCCOB1 = TargetAddress>>16;
    FTFE->FCCOB2 = TargetAddress>>8;   
    FTFE->FCCOB3 = TargetAddress;
    
    FTFE->FSTAT = 0x80; /* Launch Command */
    while (!(FTFE->FSTAT & FTFE_FSTAT_CCIF_MASK)); /* Wait till command is completed */
        
}

void FlashProgram(uint32_t TargetAddress, uint32_t Data){
    FTFE->FSTAT  = 0xF0; /* Clear Error Flags */
    FTFE->FCCOB0 = 0x0B; /* Flash Program Section Command */
    FTFE->FCCOB1 = TargetAddress>>16;
    FTFE->FCCOB2 = TargetAddress>>8;   
    FTFE->FCCOB3 = TargetAddress;
    FTFE->FCCOB4 = Data>>24;
    FTFE->FCCOB5 = Data>>16;
    FTFE->FCCOB6 = Data>>8;
    FTFE->FCCOB7 = Data;
    
    FTFE->FSTAT = 0x80; /* Launch Command */
    while (!(FTFE->FSTAT & FTFE_FSTAT_CCIF_MASK)); /* Wait till command is completed */
}

void FlashRead(void){
    uint32_t* pnt    = (uint32_t*)targetadd;
    
	read_data   = *pnt;
}
int main(void){
    SystemInit();
    FlashInit();
    targetadd = 0x10000000; /*FlexRAM start address */
    FlashEraseSector(targetadd);
    FlashProgram(targetadd, 0x10);
    FlashRead();
    while(1){
        
    }   
}

 

 

 
With this routine, I was not able to read back the data I've written. 
 
 
Regards
Prasanth
Labels (1)
0 Kudos
1 Solution
3,664 Views
CEPL_Dev
Contributor III

Hi @kerryzhou ,

I just found out what went wrong with my bare-metal code. I was not partitioning the FlexMemory for using as EEPROM. Writing to EEPROM after sending the partitioning command solved the issue.

SDK for keil still have the issues. I'm working with MCUXpresso right now. There are no SDK related issues in MCUXpresso.

Regards
Prasanth

View solution in original post

0 Kudos
17 Replies
3,777 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi CEPL_Dev,

  From your log, it seems you didn't add the header file.

  Please compare with the flexnvm_eeprom project to your own project, do you lack the header file or not?

   I think the Manage Run method issue, also related to the MDK IDE.

   So, you also can add the drivers directly to your own project, then add the header file manually.

  All the SDK drivers can be found in:

SDK_2.8.0_TWR-KE18F\devices\MKE18F16\drivers

 

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

-----------------------------------------------------------------------------

0 Kudos
3,770 Views
CEPL_Dev
Contributor III

Hi @kerryzhou ,

 

I removed all the files added through MDK and I tried manually adding the drivers from the folder you've specified.

Every time when I was building, I was getting dependency errors. I added around 7-8 header files the flash driver was asking and finally solved the dependencies. Still when building the project, I'm getting the following heap of errors.

 

Rebuild started: Project: mke18_flash
*** Using Compiler 'V6.12', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Rebuild target 'Target 1'
assembling startup_MKE18F16.s...
compiling main.c...
compiling system_MKE18F16.c...
fsl_ftfx_cache.c(10): warning: In file included from...
./fsl_ftfx_cache.h(13): warning: In file included from...
./fsl_ftfx_controller.h(13): warning: In file included from...
./fsl_ftfx_features.h(18): warning: In file included from...
./fsl_common.h(449): warning: In file included from...
./fsl_clock.h(646): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(646): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(648): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) |= PCC_CLKCFG_CGC_MASK;
^
./fsl_clock.h(658): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(658): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(660): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) &= ~PCC_CLKCFG_CGC_MASK;
^
./fsl_clock.h(672): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(672): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(674): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
return (((*(volatile uint32_t *)(uint32_t)name) & PCC_CLKCFG_INUSE_MASK) != 0UL) ? true : false;
^
./fsl_clock.h(691): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert(reg & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(691): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(692): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
assert(0UL == (reg & PCC_CLKCFG_INUSE_MASK)); /* Should not change if clock has been enabled by other core. */
^
./fsl_clock.h(692): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
./fsl_clock.h(694): error: use of undeclared identifier 'PCC_CLKCFG_PCS_MASK'
reg = (reg & ~PCC_CLKCFG_PCS_MASK) | PCC_CLKCFG_PCS(src);
^
./fsl_clock.h(694): warning: implicit declaration of function 'PCC_CLKCFG_PCS' is invalid in C99 [-Wimplicit-function-declaration]
reg = (reg & ~PCC_CLKCFG_PCS_MASK) | PCC_CLKCFG_PCS(src);
^
./fsl_clock.h(700): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) = reg & ~PCC_CLKCFG_CGC_MASK;
^
fsl_ftfx_cache.c(10): warning: In file included from...
./fsl_ftfx_cache.h(13): warning: In file included from...
./fsl_ftfx_controller.h(13): warning: In file included from...
./fsl_ftfx_features.h(18): warning: In file included from...
./fsl_common.h(486): error: use of undeclared identifier 'NotAvail_IRQn'
if (NotAvail_IRQn == interrupt)
^
./fsl_common.h(524): error: use of undeclared identifier 'NotAvail_IRQn'
if (NotAvail_IRQn == interrupt)
^
1 warning and 17 errors generated.
compiling fsl_ftfx_cache.c...
fsl_ftfx_flash.c(10): warning: In file included from...
./fsl_ftfx_flash.h(13): warning: In file included from...
./fsl_ftfx_controller.h(13): warning: In file included from...
./fsl_ftfx_features.h(18): warning: In file included from...
./fsl_common.h(449): warning: In file included from...
./fsl_clock.h(646): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(646): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(648): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) |= PCC_CLKCFG_CGC_MASK;
^
./fsl_clock.h(658): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(658): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(660): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) &= ~PCC_CLKCFG_CGC_MASK;
^
./fsl_clock.h(672): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(672): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(674): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
return (((*(volatile uint32_t *)(uint32_t)name) & PCC_CLKCFG_INUSE_MASK) != 0UL) ? true : false;
^
./fsl_clock.h(691): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert(reg & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(691): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(692): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
assert(0UL == (reg & PCC_CLKCFG_INUSE_MASK)); /* Should not change if clock has been enabled by other core. */
^
./fsl_clock.h(692): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
./fsl_clock.h(694): error: use of undeclared identifier 'PCC_CLKCFG_PCS_MASK'
reg = (reg & ~PCC_CLKCFG_PCS_MASK) | PCC_CLKCFG_PCS(src);
^
./fsl_clock.h(694): warning: implicit declaration of function 'PCC_CLKCFG_PCS' is invalid in C99 [-Wimplicit-function-declaration]
reg = (reg & ~PCC_CLKCFG_PCS_MASK) | PCC_CLKCFG_PCS(src);
^
./fsl_clock.h(700): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) = reg & ~PCC_CLKCFG_CGC_MASK;
^
fsl_ftfx_flash.c(10): warning: In file included from...
./fsl_ftfx_flash.h(13): warning: In file included from...
./fsl_ftfx_controller.h(13): warning: In file included from...
./fsl_ftfx_features.h(18): warning: In file included from...
./fsl_common.h(486): error: use of undeclared identifier 'NotAvail_IRQn'
if (NotAvail_IRQn == interrupt)
^
./fsl_common.h(524): error: use of undeclared identifier 'NotAvail_IRQn'
if (NotAvail_IRQn == interrupt)
^
fsl_ftfx_flash.c(1147): error: use of undeclared identifier 'FSL_FEATURE_FLASH_HAS_ACCESS_CONTROL'
config->flashDesc.feature.hasXaccControl = FSL_FEATURE_FLASH_HAS_ACCESS_CONTROL;
^
fsl_ftfx_flash.c(1181): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_START_ADDRESS'
pflashStartAddress = FLASH0_FEATURE_PFLASH_START_ADDRESS; /* get P-Flash start address */
^
./fsl_ftfx_adapter.h(356): note: expanded from macro 'FLASH0_FEATURE_PFLASH_START_ADDRESS'
#define FLASH0_FEATURE_PFLASH_START_ADDRESS FSL_FEATURE_FLASH_PFLASH_START_ADDRESS
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
compiling fsl_ftfx_flash.c...
fsl_ftfx_controller.c(10): warning: In file included from...
./fsl_ftfx_controller.h(13): warning: In file included from...
./fsl_ftfx_features.h(18): warning: In file included from...
./fsl_common.h(449): warning: In file included from...
./fsl_clock.h(646): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(646): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(648): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) |= PCC_CLKCFG_CGC_MASK;
^
./fsl_clock.h(658): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(658): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(660): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) &= ~PCC_CLKCFG_CGC_MASK;
^
./fsl_clock.h(672): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(672): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(674): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
return (((*(volatile uint32_t *)(uint32_t)name) & PCC_CLKCFG_INUSE_MASK) != 0UL) ? true : false;
^
./fsl_clock.h(691): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert(reg & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(691): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(692): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
assert(0UL == (reg & PCC_CLKCFG_INUSE_MASK)); /* Should not change if clock has been enabled by other core. */
^
./fsl_clock.h(692): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
./fsl_clock.h(694): error: use of undeclared identifier 'PCC_CLKCFG_PCS_MASK'
reg = (reg & ~PCC_CLKCFG_PCS_MASK) | PCC_CLKCFG_PCS(src);
^
./fsl_clock.h(694): warning: implicit declaration of function 'PCC_CLKCFG_PCS' is invalid in C99 [-Wimplicit-function-declaration]
reg = (reg & ~PCC_CLKCFG_PCS_MASK) | PCC_CLKCFG_PCS(src);
^
./fsl_clock.h(700): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) = reg & ~PCC_CLKCFG_CGC_MASK;
^
fsl_ftfx_controller.c(10): warning: In file included from...
./fsl_ftfx_controller.h(13): warning: In file included from...
./fsl_ftfx_features.h(18): warning: In file included from...
./fsl_common.h(486): error: use of undeclared identifier 'NotAvail_IRQn'
if (NotAvail_IRQn == interrupt)
^
./fsl_common.h(524): error: use of undeclared identifier 'NotAvail_IRQn'
if (NotAvail_IRQn == interrupt)
^
fsl_ftfx_controller.c(197): error: use of undeclared identifier 'FSL_FEATURE_FLASH_FLEX_RAM_START_ADDRESS'
config->flexramBlockBase = FSL_FEATURE_FLASH_FLEX_RAM_START_ADDRESS;
^
fsl_ftfx_controller.c(198): error: use of undeclared identifier 'FSL_FEATURE_FLASH_FLEX_RAM_SIZE'
config->flexramTotalSize = FSL_FEATURE_FLASH_FLEX_RAM_SIZE;
^
1 warning and 19 errors generated.
compiling fsl_ftfx_controller.c...
fsl_ftfx_flexnvm.c(10): warning: In file included from...
./fsl_ftfx_flexnvm.h(13): warning: In file included from...
./fsl_ftfx_controller.h(13): warning: In file included from...
./fsl_ftfx_features.h(18): warning: In file included from...
./fsl_common.h(449): warning: In file included from...
./fsl_clock.h(646): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(646): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(648): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) |= PCC_CLKCFG_CGC_MASK;
^
./fsl_clock.h(658): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(658): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(660): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) &= ~PCC_CLKCFG_CGC_MASK;
^
./fsl_clock.h(672): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert((*(volatile uint32_t *)((uint32_t)name)) & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(672): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(674): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
return (((*(volatile uint32_t *)(uint32_t)name) & PCC_CLKCFG_INUSE_MASK) != 0UL) ? true : false;
^
./fsl_clock.h(691): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
assert(reg & PCC_CLKCFG_PR_MASK);
^
./fsl_clock.h(691): error: use of undeclared identifier 'PCC_CLKCFG_PR_MASK'
./fsl_clock.h(692): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
assert(0UL == (reg & PCC_CLKCFG_INUSE_MASK)); /* Should not change if clock has been enabled by other core. */
^
./fsl_clock.h(692): error: use of undeclared identifier 'PCC_CLKCFG_INUSE_MASK'
./fsl_clock.h(694): error: use of undeclared identifier 'PCC_CLKCFG_PCS_MASK'
reg = (reg & ~PCC_CLKCFG_PCS_MASK) | PCC_CLKCFG_PCS(src);
^
./fsl_clock.h(694): warning: implicit declaration of function 'PCC_CLKCFG_PCS' is invalid in C99 [-Wimplicit-function-declaration]
reg = (reg & ~PCC_CLKCFG_PCS_MASK) | PCC_CLKCFG_PCS(src);
^
./fsl_clock.h(700): error: use of undeclared identifier 'PCC_CLKCFG_CGC_MASK'
(*(volatile uint32_t *)((uint32_t)name)) = reg & ~PCC_CLKCFG_CGC_MASK;
^
fsl_ftfx_flexnvm.c(10): warning: In file included from...
./fsl_ftfx_flexnvm.h(13): warning: In file included from...
./fsl_ftfx_controller.h(13): warning: In file included from...
./fsl_ftfx_features.h(18): warning: In file included from...
./fsl_common.h(486): error: use of undeclared identifier 'NotAvail_IRQn'
if (NotAvail_IRQn == interrupt)
^
./fsl_common.h(524): error: use of undeclared identifier 'NotAvail_IRQn'
if (NotAvail_IRQn == interrupt)
^
1 warning and 17 errors generated.
compiling fsl_ftfx_flexnvm.c...
".\Objects\mke18_flash.axf" - 72 Error(s), 4 Warning(s).
Target not created.
Build Time Elapsed: 00:00:01

Regards
Prasanth
0 Kudos
3,740 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi CEPL_Dev

   Send me your modified MDK project, I will help you to check it.

 

Best Regards,

Kerry

0 Kudos
3,736 Views
CEPL_Dev
Contributor III

Here's a new MDK project I've created with no user code. I just added the necessary files for the flash driver and compiled the project it's not compiling. 

Regards
Prasanth
0 Kudos
3,726 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi CEPL_Dev,

    I checked your project, also have the issues, it should be related to the MDK packs compatibility with the SDK.

   Do you mind to use the SDK flexnvm_eeprom mdk project directly?

   I use the MCUXPresso CFG tool clone one flexnvm_eeprom mdk project, it can be build correctly directly.

   You can based on that project, if you want to change the name, you can modify it directly, and if you want to delete some files, you also can delete it, this project is totally from the SDK and compatible with the SDK.

  I attached the MDK project directly, please check it on your side.

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

-----------------------------------------------------------------------------

0 Kudos
3,718 Views
CEPL_Dev
Contributor III

Hi @kerryzhou 

I tried building the project you've given. It's compiling successfully without any errors, however when I tried to load it to a MKE18F512VLL16 micro-controller, the code execution halted at the initialization stage. I checked in debug mode by stepping line by line and found out that the code is looping among the below mentioned addresses. Please see the disassembly window of the following screenshot.

CEPL_Dev_0-1602485498252.png

 

 I didn't modify the project you've given. I just built it and downloaded it to the MCU as it is. 

Regards
Prasanth
0 Kudos
3,688 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi CEPL_Dev,

   TWR-KE18F board is also using :MKE18F512VLL16

  Please check your board schematic, do you use the external 8Mhz crystal?

image.png

The SDK code is using the external 8Mhz crystal as the clock source.

So, please check your board at first.

Any updated information, just kindly let me know.

Best Regards,

Kerry

0 Kudos
3,681 Views
CEPL_Dev
Contributor III

Hi @kerryzhou ,

I was using internal oscillator in my design. Removing the board specific initializations from the SDK code solved the issue. However I'm not going to use this in my MDK project.

I'm moving from Keil MDK to MCUXpresso  as our primary tool for development with Kinetis MCUs as recommended by everyone from NXP. I hope that will be a wiser decision in long run to avoid SDK related issues and to achieve better time to market.

Thank you so much for helping me out.

Good Day!   

Regards
Prasanth
0 Kudos
3,673 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi CEPL_Dev

   Thanks let me know you already make it works.

    You can use the MCUXPresso IDE, as this IDE is from NXP, we have a team to support it.

 

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

-----------------------------------------------------------------------------

3,665 Views
CEPL_Dev
Contributor III

Hi @kerryzhou ,

I just found out what went wrong with my bare-metal code. I was not partitioning the FlexMemory for using as EEPROM. Writing to EEPROM after sending the partitioning command solved the issue.

SDK for keil still have the issues. I'm working with MCUXpresso right now. There are no SDK related issues in MCUXpresso.

Regards
Prasanth
0 Kudos
3,709 Views
kerryzhou
NXP TechSupport
NXP TechSupport

HI CEPL_Dev

  What's the detail chip you are using?

   The same as TWR-KE18F?MKE18F512VLL16?

Please double check your board chip partnumber.

Do you also test the SDK code directly any issues or not?

SDK_2.8.0_TWR-KE18F\boards\twrke18f\driver_examples\flash\flexnvm_eeprom

Best Regards,

KERRY

0 Kudos
3,704 Views
CEPL_Dev
Contributor III

@kerryzhou 

I'm using MKE18F512VLL16. I tried uploading the example from SDK_2.8.0_TWR-KE18F\boards\twrke18f\driver_examples\flash\flexnvm_eeprom.

The same problem posted above persists.

Regards
Prasanth
0 Kudos
3,782 Views
CEPL_Dev
Contributor III

Hi @kerryzhou ,

The example project @ SDK_2.8.0_MKE18F512xxx16\boards\twrke18f\driver_examples\flash\flexnvm_eeprom\mdk is compiling without any errors,

But when I try to add the NXP SDK Peripheral Driver to my project using the MDK Software Component Selector, I'm getting so many errors. I chose to "Auto Resolve" all dependencies when I selected the flash driver to add in to the project.

CEPL_Dev_1-1602316441257.png

 

This is the build output with compiler v6.12.

Rebuild started: Project: mke18_flash
*** Using Compiler 'V6.12', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Rebuild target 'Target 1'
compiling fsl_ftfx_flexnvm.c...
compiling main.c...
compiling fsl_common.c...
compiling fsl_ftfx_cache.c...
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1147): error: use of undeclared identifier 'FSL_FEATURE_FLASH_HAS_ACCESS_CONTROL'
config->flashDesc.feature.hasXaccControl = FSL_FEATURE_FLASH_HAS_ACCESS_CONTROL;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1181): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_START_ADDRESS'
pflashStartAddress = FLASH0_FEATURE_PFLASH_START_ADDRESS; /* get P-Flash start address */
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_adapter.h(356): note: expanded from macro 'FLASH0_FEATURE_PFLASH_START_ADDRESS'
#define FLASH0_FEATURE_PFLASH_START_ADDRESS FSL_FEATURE_FLASH_PFLASH_START_ADDRESS
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1182): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE'
pflashBlockSize = FLASH0_FEATURE_PFLASH_BLOCK_SIZE;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_adapter.h(358): note: expanded from macro 'FLASH0_FEATURE_PFLASH_BLOCK_SIZE'
#define FLASH0_FEATURE_PFLASH_BLOCK_SIZE FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1183): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT'
pflashBlockCount = FLASH0_FEATURE_PFLASH_BLOCK_COUNT;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_adapter.h(357): note: expanded from macro 'FLASH0_FEATURE_PFLASH_BLOCK_COUNT'
#define FLASH0_FEATURE_PFLASH_BLOCK_COUNT FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1184): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE'
pflashBlockSectorSize = FLASH0_FEATURE_PFLASH_BLOCK_SECTOR_SIZE;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_adapter.h(359): note: expanded from macro 'FLASH0_FEATURE_PFLASH_BLOCK_SECTOR_SIZE'
#define FLASH0_FEATURE_PFLASH_BLOCK_SECTOR_SIZE FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1185): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
pflashBlockWriteUnitSize = FLASH0_FEATURE_PFLASH_BLOCK_WRITE_UNIT_SIZE;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_adapter.h(360): note: expanded from macro 'FLASH0_FEATURE_PFLASH_BLOCK_WRITE_UNIT_SIZE'
#define FLASH0_FEATURE_PFLASH_BLOCK_WRITE_UNIT_SIZE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1186): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_SECTOR_CMD_ADDRESS_ALIGMENT'
pflashSectorCmdAlignment = FLASH0_FEATURE_PFLASH_SECTOR_CMD_ADDRESS_ALIGMENT;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_adapter.h(361): note: expanded from macro 'FLASH0_FEATURE_PFLASH_SECTOR_CMD_ADDRESS_ALIGMENT'
#define FLASH0_FEATURE_PFLASH_SECTOR_CMD_ADDRESS_ALIGMENT FSL_FEATURE_FLASH_PFLASH_SECTOR_CMD_ADDRESS_ALIGMENT
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1187): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT'
pflashSectionCmdAlignment = FLASH0_FEATURE_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_adapter.h(362): note: expanded from macro 'FLASH0_FEATURE_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT'
#define FLASH0_FEATURE_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT FSL_FEATURE_FLASH_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1222): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_RESOURCE_CMD_ADDRESS_ALIGMENT'
(uint8_t)FSL_FEATURE_FLASH_PFLASH_RESOURCE_CMD_ADDRESS_ALIGMENT;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1225): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_CHECK_CMD_ADDRESS_ALIGMENT'
(uint8_t)FSL_FEATURE_FLASH_PFLASH_CHECK_CMD_ADDRESS_ALIGMENT;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1228): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_SWAP_CONTROL_CMD_ADDRESS_ALIGMENT'
(uint8_t)FSL_FEATURE_FLASH_PFLASH_SWAP_CONTROL_CMD_ADDRESS_ALIGMENT;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_flash.c(1274): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_PROTECTION_REGION_COUNT'
pflashProtectionRegionCount = FLASH0_FEATURE_PFLASH_PROTECTION_REGION_COUNT;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_adapter.h(363): note: expanded from macro 'FLASH0_FEATURE_PFLASH_PROTECTION_REGION_COUNT'
#define FLASH0_FEATURE_PFLASH_PROTECTION_REGION_COUNT FSL_FEATURE_FLASH_PFLASH_PROTECTION_REGION_COUNT
^
12 errors generated.
compiling fsl_ftfx_flash.c...
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_controller.c(197): error: use of undeclared identifier 'FSL_FEATURE_FLASH_FLEX_RAM_START_ADDRESS'
config->flexramBlockBase = FSL_FEATURE_FLASH_FLEX_RAM_START_ADDRESS;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/drivers/fsl_ftfx_controller.c(198): error: use of undeclared identifier 'FSL_FEATURE_FLASH_FLEX_RAM_SIZE'
config->flexramTotalSize = FSL_FEATURE_FLASH_FLEX_RAM_SIZE;
^
2 errors generated.
compiling fsl_ftfx_controller.c...
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(75): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
uint32_t progBuf[PGM_SIZE_BYTE / sizeof(uint32_t)];
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(79): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
if (((size & ((uint8_t)PGM_SIZE_BYTE - 0x01U)) != 0U) || ((dest & ((uint8_t)PGM_SIZE_BYTE - 0x01U)) != 0U))
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(79): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
if (((size & ((uint8_t)PGM_SIZE_BYTE - 0x01U)) != 0U) || ((dest & ((uint8_t)PGM_SIZE_BYTE - 0x01U)) != 0U))
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(86): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
(void)memcpy((void *)((uint32_t *)&progBuf[0]), (const void *)pData, PGM_SIZE_BYTE);
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(88): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
status = FLASH_Program(flashConfig, dest, (uint8_t *)progBuf, PGM_SIZE_BYTE);
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(94): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
pData += PGM_SIZE_BYTE;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(95): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
dest += PGM_SIZE_BYTE;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(96): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
size -= PGM_SIZE_BYTE;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(193): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
uint8_t buffer[PGM_SIZE_BYTE];
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(194): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
uint16_t bytes = (uint16_t)(dest & ((uint32_t)PGM_SIZE_BYTE - 1U));
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(200): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
uint16_t unalignedBytes = (uint16_t)PGM_SIZE_BYTE - bytes;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(207): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
(void)memcpy(buffer, (void *)((uint16_t *)(dest - bytes)), PGM_SIZE_BYTE);
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(210): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
status = HAL_FlashProgramAdaptation(halFlashHandle, dest - bytes, PGM_SIZE_BYTE, buffer);
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(217): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
dest += (uint32_t)PGM_SIZE_BYTE - bytes;
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(222): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
bytes = (uint16_t)(size & ~((uint8_t)PGM_SIZE_BYTE - 1U));
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(240): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
(void)memcpy(buffer, (void *)((uint32_t *)dest), PGM_SIZE_BYTE);
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(243): error: use of undeclared identifier 'FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE'
return HAL_FlashProgramAdaptation(halFlashHandle, dest, PGM_SIZE_BYTE, buffer);
^
C:/Keil_v5/ARM/PACK/NXP/MKE18F16_DFP/12.2.0/components/internal_flash/flash_adapter.c(22): note: expanded from macro 'PGM_SIZE_BYTE'
#define PGM_SIZE_BYTE FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
^
17 errors generated.
compiling flash_adapter.c...
compiling fsl_clock.c...
assembling startup_MKE18F16.s...
compiling system_MKE18F16.c...
".\Objects\mke18_flash.axf" - 31 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:01

 

Regards
Prasanth
0 Kudos
3,826 Views
CEPL_Dev
Contributor III

I tried using the NXP SDK, but I'm getting the following dependency errors although I selected to auto resolve all pack requirements while including the drivers in the project. A lot of macros seem to be undefined.

 
Rebuild started: Project: mke18_flash
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Rebuild target 'Target 1'
assembling startup_MKE18F16.s...
compiling fsl_ftfx_flash.c...
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(82): warning:  #1296-D: extended constant initialiser used
  static volatile uint32_t *const kFPROTL = (volatile uint32_t *)(uint32_t)&FTFx_FPROT_LOW_REG;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(582): warning:  #186-D: pointless comparison of unsigned integer with zero
          for (uint32_t i = 0U; i < (uint32_t)MAX_FLASH_PROT_REGION_COUNT;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(617): warning:  #1296-D: extended constant initialiser used
          static volatile uint32_t *const kFPROTLx = (volatile uint32_t *)(uint32_t)&FTFx_FPROTL3_REG;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(633): warning:  #186-D: pointless comparison of unsigned integer with zero
                  if (regionCounter < (uint32_t)MAX_FLASH_PROT_REGION_COUNT)
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1147): error:  #20: identifier "FSL_FEATURE_FLASH_HAS_ACCESS_CONTROL" is undefined
      config->flashDesc.feature.hasXaccControl = FSL_FEATURE_FLASH_HAS_ACCESS_CONTROL;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1181): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_START_ADDRESS" is undefined
          pflashStartAddress        = FLASH0_FEATURE_PFLASH_START_ADDRESS; /* get P-Flash start address */
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1182): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE" is undefined
          pflashBlockSize           = FLASH0_FEATURE_PFLASH_BLOCK_SIZE;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1183): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT" is undefined
          pflashBlockCount          = FLASH0_FEATURE_PFLASH_BLOCK_COUNT;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1184): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE" is undefined
          pflashBlockSectorSize     = FLASH0_FEATURE_PFLASH_BLOCK_SECTOR_SIZE;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1185): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE" is undefined
          pflashBlockWriteUnitSize  = FLASH0_FEATURE_PFLASH_BLOCK_WRITE_UNIT_SIZE;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1186): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_SECTOR_CMD_ADDRESS_ALIGMENT" is undefined
          pflashSectorCmdAlignment  = FLASH0_FEATURE_PFLASH_SECTOR_CMD_ADDRESS_ALIGMENT;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1187): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT" is undefined
          pflashSectionCmdAlignment = FLASH0_FEATURE_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1222): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_RESOURCE_CMD_ADDRESS_ALIGMENT" is undefined
          (uint8_t)FSL_FEATURE_FLASH_PFLASH_RESOURCE_CMD_ADDRESS_ALIGMENT;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1225): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_CHECK_CMD_ADDRESS_ALIGMENT" is undefined
          (uint8_t)FSL_FEATURE_FLASH_PFLASH_CHECK_CMD_ADDRESS_ALIGMENT;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1228): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_SWAP_CONTROL_CMD_ADDRESS_ALIGMENT" is undefined
          (uint8_t)FSL_FEATURE_FLASH_PFLASH_SWAP_CONTROL_CMD_ADDRESS_ALIGMENT;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c(1274): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_PROTECTION_REGION_COUNT" is undefined
          pflashProtectionRegionCount = FLASH0_FEATURE_PFLASH_PROTECTION_REGION_COUNT;

C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_flash.c: 4 warnings, 12 errors
compiling fsl_ftfx_controller.c...
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_controller.c(158): warning:  #1296-D: extended constant initialiser used
  static volatile uint32_t *const kFCCOBx = (volatile uint32_t *)(uint32_t)&FTFx_FCCOB3_REG;
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_controller.c(197): error:  #20: identifier "FSL_FEATURE_FLASH_FLEX_RAM_START_ADDRESS" is undefined
      config->flexramBlockBase                = FSL_FEATURE_FLASH_FLEX_RAM_START_ADDRESS;

C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_controller.c(198): error:  #20: identifier "FSL_FEATURE_FLASH_FLEX_RAM_SIZE" is undefined
      config->flexramTotalSize                = FSL_FEATURE_FLASH_FLEX_RAM_SIZE;

C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\drivers\fsl_ftfx_controller.c: 1 warning, 2 errors
compiling main.c...
compiling fsl_ftfx_cache.c...
compiling system_MKE18F16.c...
compiling fsl_common.c...
compiling fsl_clock.c...
compiling fsl_ftfx_flexnvm.c...
compiling flash_adapter.c...
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\components\internal_flash\flash.h(93): warning:  #66-D: enumeration value is out of "int" range
      kHAL_Flash_SecurityStateNotSecure        = 0xc33cc33cU, /*!< Flash is not secure.*/
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\components\internal_flash\flash_adapter.c(75): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE" is undefined
      uint32_t progBuf[PGM_SIZE_BYTE / sizeof(uint32_t)];
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\components\internal_flash\flash_adapter.c(193): error:  #20: identifier "FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE" is undefined
      uint8_t buffer[PGM_SIZE_BYTE];
C:\Keil_v5\ARM\PACK\NXP\MKE18F16_DFP\12.2.0\components\internal_flash\flash_adapter.c: 1 warning, 2 errors
".\Objects\mke18_flash.axf" - 16 Error(s), 6 Warning(s).
Target not created.
Build Time Elapsed:  00:00:03
Regards
Prasanth
0 Kudos
3,801 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi CEPL_Dev,

  Do you test the NXP official SDK EEPROM code for TWR-KE18F:

SDK_2.8.0_TWR-KE18F\boards\twrke18f\driver_examples\flash\flexnvm_eeprom

Whether this project can works on your side or not?

You can use the NXP offical code at first.

Any updated information, please kindly let me know.

Best Regards,

Kerry

0 Kudos
3,794 Views
CEPL_Dev
Contributor III

Yes, I tried using the SDK from NXP. I've attached the files in my question. The previous reply shows the errors that come when I try to compile my code with the SDK in it.

Regards
Prasanth
0 Kudos
3,787 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi CEPL_Dev,

   Thanks for your updated information, you even have the orginal SDK project build issues.

   What's the SDK version you are using? and the MDK version you are using?

   I am using SDK_2.8.0_TWR-KE18F, MDK version is v5.29.

If you check the SDK release note, you can find the request tools:

3 Development tools
The MCUXpresso SDK was compiled and tested with these development tools:
• IAR Embedded Workbench for Arm version 8.50.5
• MDK-Arm Microcontroller Development Kit (Keil)® 5.31
• Makefiles support with GCC revision 9-2019-q4-major GCC9 from Arm Embedded
• MCUXpresso IDE v11.2.0

when I build the flexnvm_eeprom project. this is my result:

-----------------------------------------

Rebuild started: Project: flexnvm_eeprom
*** Using Compiler 'V6.13.1', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Rebuild Project 'flexnvm_eeprom' - Target 'flexnvm_eeprom debug'
compiling clock_config.c...
compiling pin_mux.c...
compiling fsl_ftfx_controller.c...
compiling fsl_ftfx_cache.c...
compiling fsl_ftfx_flash.c...
compiling flexnvm_eeprom.c...
compiling board.c...
compiling fsl_ftfx_flexnvm.c...
compiling fsl_clock.c...
compiling fsl_common.c...
compiling fsl_gpio.c...
compiling fsl_smc.c...
compiling system_MKE18F16.c...
compiling fsl_debug_console.c...
compiling fsl_lpuart.c...
compiling fsl_str.c...
compiling fsl_assert.c...
compiling serial_manager.c...
compiling lpuart_adapter.c...
compiling serial_port_uart.c...
compiling generic_list.c...
assembling startup_MKE18F16.S...
linking...
Program Size: Code=8296 RO-data=2964 RW-data=8 ZI-data=2260
"debug\flexnvm_eeprom.out" - 0 Error(s), 0 Warning(s).
Build Time Elapsed: 00:00:06

-----------------------------------------

So, from your log, your compiler version is not correct.

image.png

Please also following the SDK_2.8.0_TWR-KE18F\docs\Getting Started with MCUXpresso SDK.pdf

And test it again.

Any updated information, just kindly let me know.

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

-----------------------------------------------------------------------------

0 Kudos