How to fix these errors in my code ?

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

How to fix these errors in my code ?

1,273 Views
ganeshramachand
Contributor IV

I am using

Hardware: MKE02Z64VLD2

IDE: Kinetis Design Studio 2.0.

BL_SW: PTB1

When I "Build" the code, I got following errors.

1. Error in the Flash Declaration

146173_146173.jpgFlash Error.jpg

           IT SAYS THAT THE IntFlashLdd1_ERASABLE_UNIT_SIZE IS UNDECLARED           

146177_146177.jpgFlash Config.jpg

     IN ORDER TO FIX THE ERROR SHOULD I ENABLE OR DISABLE ANY FEATURES INSIDE THE FLASH COMPONENT ?    

(if the pic is not clear) As of now the Enabled features are,

  1. IntFlashLdd1:FLASH_LDD
  2. EraseSector
  3. SetByteFlash
  4. GetByteFlash
  5. SetWordFlash
  6. SetBlockFlash
  7. IFsh1_OnWriteEnd

1.How to fix this Error pertaining to Flash Declaration ??

 

2. Errors in Clocking and Enabling Pull Up

146178_146178.jpgCLock and PUll up enable errors.jpg

                              SAME UNDECLARED ERRORS HERE TOO                               

SIM_SCGC5.... SYNTAX  does not support KINETIS E CONTROLLERS I guess. So I asked in this same forum and got this reply.

Clocking Port Pins in KE-02Z Controllers

2.a. From the answer, if clocking is done automatically after reset, then can I simply delete that code and start over with

/*Configure Pin as Input */

?????

2.b. The next problem is with enabling the Pull Up. I guess there should be different syntax for Kinetis E series Controller.

These are the Components inside my PDD --> Port, in my Processor Expert.

146179_146179.jpgPort Config.jpg

So to fix those errors in 2 statements pertaining to Pull up, which 2 statements are to be selected ?

PORT_PDD_SetPinPullSelect(PORTB_BASE_PTR, 1, PORT_PDD_PULL_UP);
PORT_PDD_SetPinPullEnable(PORTB_BASE_PTR, 1, PORT_PDD_PULL_ENABLE);

What are the alternative statements fixing my problem ?

I request you to please answer my 1, 2.a, 2.b queries.

I repeat the queries alone..

1.How to fix this Error pertaining to Flash Declaration ??

 

2.a. From the answer, if clocking is done automatically after reset, then can I simply delete that code and start over with  /*Configure Pin as Input */  ?????

2.b. The next problem is with enabling the Pull Up. I guess there should be different syntax for Kinetis E series Controller. So to fix those errors in 2 statements pertaining to Pull up, which 2 statements are to be selected ?

Labels (1)
6 Replies

975 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ganesh,

1. You only can use the functions the components for your chip have :

pastedImage_0.pngpastedImage_1.png

If you copy the code from other chips , you should be sure for your chip , it also have the define .

2. For the GPIO , yes , you can directly configure the GPIO without enable the port clock .

3.About the pullup, you can configure it at the "Init_PORT"component to configure it :

pastedImage_2.png

If still have any question , you can send your project to me .

Hope it helps


Have a great day,
Alice

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

975 Views
ganeshramachand
Contributor IV

Dear Alice, I am a beginner to embedded systems itself. I am trying to design a bootloader for Kinetis E series Microcontroller (MKE02Z64VLD2) on my own. I am using KDS 2.0 .. I have attached my project. Can you check and fix the errors and statements which wont suit Kinetis E series Controller ?

Thanks

0 Kudos
Reply

975 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ganesh,

About your project , it is hard to fix , i don't know where is the project you porting,

when i open it on my KDS, it show like this, and also i have not install some PE bins .

pastedImage_0.png

So i recommend you one bootloader project , it development on FRDM-KE02Z40(the chip is MKE02Z64VQH4),

Please see the attachment KE02-SC.zip, this is run on IAR , i also have one KDS version , it is ported from the IAR.

You can test them .

Hope it helps


Have a great day,
Alice

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

975 Views
ganeshramachand
Contributor IV

Hey Alice,

Thanks alot for sharing those projects :smileyhappy:  . But still if possible can you just fix or guide me a possible replacement for this code snippet.

#include "BL_SW.h"

#include "PORT_PDD.h"

static bool BL_CheckBootloaderMode(void) {

  /* let's check if the user presses the BTLD switch. Need to configure the pin first */

  /* PTB1 as input */

  /* clock all port pins */

  SIM_SCGC5   |= SIM_SCGC5_PORTA_MASK |

              SIM_SCGC5_PORTB_MASK |

              SIM_SCGC5_PORTC_MASK |

              SIM_SCGC5_PORTD_MASK |

              SIM_SCGC5_PORTE_MASK;

  /* Configure pin as input */

#if 0

/* GPIOB_PDDR: PDD&=~0x0100 */

GPIOB_PDDR = (uint32_t)((GPIOB_PDDR & (uint32_t)~0x0100UL) | (uint32_t)0x00UL);

/* Initialization of Port Control register */

/* PORTB_PCR1: ISF=0,MUX=1 */

PORTB_PCR1 = (uint32_t)((PORTB_PCR1 & (uint32_t)~0x01000600UL) | (uint32_t)0x0100UL);

#else

  (void)BitIoLdd1_Init(NULL); /* initialize the port pin PTB8 */

  /* enable internal pull-up on PTB1 */

  PORT_PDD_SetPinPullSelect(PORTB_BASE_PTR, 1, PORT_PDD_PULL_UP);

  PORT_PDD_SetPinPullEnable(PORTB_BASE_PTR, 1, PORT_PDD_PULL_ENABLE);

  WAIT1_Waitms(5); /* wait get pull-up a chance to pull-up */

  #endif

    if (!BL_SW_GetVal()) { /* button pressed (has pull-up!) */

      WAIT1_Waitms(50); /* wait to debounce */

      if (!BL_SW_GetVal()) { /* still pressed */

        return TRUE; /* go into boot loader mode */

      }

    }

    /* BTLD switch not pressed, and we have a valid user application vector */

    return FALSE; /* do not enter boot loader mode */

  }

What the above code has to do is to Clock all the port pins, Configure Port B pin 1 (PTB1) as input, initialize the port pin PTB1, enable internal pull-up on PTB1, rest are common Wait statements.

You said, In KE-02 controllers, clocking is done by default after reset. But am clueless as to how to write the code for other operations mentioned above.  Can you provide me a code snippet which replaces the above but supports KE-02Z controllers.
I owe a deep gratitude to you Alice :smileyhappy: . Thanks alot.

0 Kudos
Reply

975 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ganesh,

Your cod is clearly not for the kentis E series . So i recommend you refer to one simle

KE series project code .

For example , for the PTB1 you said , you can create one simple PE project on KDS:

pastedImage_0.png

then add "GPIO_LDD" component , configure it , and refer to the "typical usage" to test :

pastedImage_2.png

pastedImage_1.png

I chacked you use the BITIO component,  ok, this is the same ,you can also refer the typical usage :

pastedImage_3.png

Please give up these code you show , they will confused you .

BR

Alice

975 Views
MarekTrmac
NXP Employee
NXP Employee

Hi Ganesh,

please ensure, you have set in your project option to generate code before the build. Use project - properties and see attached picture, the option shall be on by default. You can also generate code from Components view - see command "Generate Code". I tried to reproduce the problem with Flash in KDS 3.2 and I did not reproduce it.

Capture.PNG

About the supported registers, please refer to header file located in "Static_Code\IO_Map\MK02Z2.h" in your project (after code generation). The header file contains declarations how to access registers and thier bitfields.

Regards

Marek

0 Kudos
Reply