2387889_en-US

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

2387889_en-US

2387889_en-US

SIM Macro activation in MCUxpresso

I'm picking up an old project that was originally built using KDE and later modified using mcuexpresso.

I downloaded the latest version of the IDE and created a new C/C++ project using SDK2.11.0 for the FRDM_K64F board which I have.

I'm copying code from the old project as it had all sorts of stuff I don't want anymore and am trying to build up in the new project from scratch.

The first code I pasted in was a port initialisation.

Problem is when I compile I get "undefined'' errors on all hardware references:

./source/Frere_2016.c:52:1: error: 'SIM_SCGC5' undeclared (first use in this function)
52 | SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK; // Enable Port A Clock Gate C

I have unzipped the SDK with no difference.

It seems that the original source code must have had some assignment made which I am not copying, but surely that should be covered in a new project by the following:

#include
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_debug_console.h"

I even tried adding #include "MK64F12.h" to no avail

Any help really apprecaited!

Thanks

Nigel







So I started



Re: SIM Macro activation in MCUxpresso

Hello @ve3id 

The compile error happens because SIM_SCGC5 is an old Kinetis register symbol; in MCUXpresso SDK 2.x for FRDM-K64F you should use SIM->SCGC5 and similarly convert the other hardware register references to PERIPHERAL->REGISTER syntax.

For you specific line, change

SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;

to 

SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK;


Thank you.


BR

Alice

Re: SIM Macro activation in MCUxpresso

Thank you very much, Alice.  You are so knowledgeable that you make it look easy!

Now I can get on with my project

cheers

Nigel


Tags (1)
No ratings
Version history
Last update:
4 weeks ago
Updated by: