1 month, 1 week ago.

How to perform direct register accesses?

For a class I am in, we must program the K64F board using direct register accesses; that is, no high-level libraries.

Technically I could open the reference manual and look up the addresses of each and every register I need to configure, but is there a better way?

When using Kinetis, there is a file called MK64F12.h which has macros for all the register accesses. However, it is part of a bigger library and impossible to use by itself.

How could I do baremetal (i.e. direct register access) programming using the mbed compiler?

Question relating to:

The Freedom-K64F is an ultra-low-cost development platform for Kinetis K64, K63, and K24 MCUs.
Comment on this question

2 Answers

1 month, 1 week ago.

I believe you can still use macros in the MK64F12.h header file.

I'm not sure how to use this. I tried importing, but it still doesn't recognize the register names in my code (gives me undefined identifier errors). How would I use this file?

posted by Marco Merlini 14 Feb 2017

I've just now realized that this is a different K64F12.h file from the one used in Kinetis. The way to use the macros is different

posted by Marco Merlini 14 Feb 2017

That file is automatically included in mbed by the way, you don't need to import or include anything. And it works the same for each mbed target (of course with different register names, but the C++ style register addressing is used for all).

posted by Erik Olieman 14 Feb 2017
1 month, 1 week ago.

This discussion may help you ;)

So I have no choice but to use the memory addresses?

posted by Marco Merlini 13 Feb 2017

To post an answer, please log in.