FlashEraseSector by ProcessorExpert in MK22FN128VLH10

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

FlashEraseSector by ProcessorExpert in MK22FN128VLH10

Jump to solution
1,730 Views
양승도
Contributor II

I tried to implement the FlashEraseSector like the example in flash_example_frdmk22f, before to implement FlashProgram. however; it returns "0x20"(FTFx_ERR_ACCERR).

 

- Environment:

MCU: MK22FN128VLH10

KDS: 3.0.0

KSDK: 1.2.0

Windows 10

 

- I set up the settings as following:

 

<in flash1:fsl_flash>

C90TFS register base address: 0x40020000

Program flash base address: 0x00000000

Size of program flash: 0x00020000

Data flash base address: 0x00000000

FlexRam base address: 0x00000000

Background debug mode enable: Disable

 

<in osa1:fsl_os_abstraction>

OS: BareMetal

Used timer: None

 

- I attached a picture of "return 0x20" and source code.

Flash.png -> a picture of "return 0x20"

MK22FN128VLH10_Peripheral.zip -> source code with ProcessorExpert file

Original Attachment has been moved to: MK22FN128VLH10_Peripheral.zip

0 Kudos
Reply
1 Solution
1,365 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Frank,

    Please modify the clockMan1:

    FLLouput =40Mhz

    Core clock = 40Mhz,

  Then generate the code, build and run it again, whether this error still happens on your MK22FN128VLH10 board?

  After you test it, please give me your test result.


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

6 Replies
1,365 Views
mjbcswitzerland
Specialist V

Hi

Your problem is probably the HIGH SSPEED RUN mode which is used to clock at above 80MHz. In HIGH SPEE RUN mode it is not possible to erase or program Flash (see the restrictions in the K22 user's manual).

As long as you don't work at > 80Mhz and don't use the HIGH SPEED RUN mode there are no restrictions.

It also works at 120MHz if you don't use HIGH SPEED RUN mode but the clocks are out of specification according to the data sheet (for tests it does however usually work normally).

Regards

Mark

0 Kudos
Reply
1,365 Views
양승도
Contributor II

I have a question more.

Do I have to use 40MHz when I use Flash functions?

I want to use 80MHz Core Clock to implement my functions based by high speed core clock.

How do I implement codes with 80MHz high speed core clock and 40MHz clock flash functions simultaneously?

0 Kudos
Reply
1,365 Views
양승도
Contributor II

It works at 40MHz of FLLoutput and Core clock.

It returns 0x00 @ 40MHz.

If I have more question for Flash, I will reply again.

Thank you

0 Kudos
Reply
1,366 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Frank,

    Please modify the clockMan1:

    FLLouput =40Mhz

    Core clock = 40Mhz,

  Then generate the code, build and run it again, whether this error still happens on your MK22FN128VLH10 board?

  After you test it, please give me your test result.


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,365 Views
양승도
Contributor II

I have a question more.

Do I have to use 40MHz when I use Flash functions?

I want to use 80MHz Core Clock to implement my functions based by high speed core clock.

How do I implement codes with 80MHz high speed core clock and 40MHz clock flash functions simultaneously?

0 Kudos
Reply
1,365 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Frank Yang,

    From the reference manual, you may know that:

1. The core and system clock frequencies must be 100 MHz or slower in HSRUN, 72MHz or slower in RUN.

If you configure the core clock at 80Mhz, it is the HSRUN mode, in  the HSRUN mode:Flash programming/erasing is not allowed, you can find this in the reference manual:K22P121M100SF9RM.pdf, page 343.

Wish it helps you!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply