I am using
Hardware: MKE02Z64VLD2
IDE: Kinetis Design Studio 2.0.
BL_SW: PTB1
When I "Build" the code, I got following errors.
IT SAYS THAT THE IntFlashLdd1_ERASABLE_UNIT_SIZE IS UNDECLARED
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,
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
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..
Hello Ganesh,
1. You only can use the functions the components for your chip have :
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 :
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!
-----------------------------------------------------------------------------------------------------------------------
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
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 .
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!
-----------------------------------------------------------------------------------------------------------------------
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.
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:
then add "GPIO_LDD" component , configure it , and refer to the "typical usage" to test :
I chacked you use the BITIO component, ok, this is the same ,you can also refer the typical usage :
Please give up these code you show , they will confused you .
BR
Alice
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.
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