SPI in MQX 4.0

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

SPI in MQX 4.0

945 Views
mehdikarimibiuk
Contributor V

Is there any way in MQX 4.0, that instead of using high level driver, using low level drivers by reading from and writing to SPI registers directly?

I see that in K60 Reference Manual chapter 50, attached, SPI registers are explained extensively, so I would like to instead of using high level drivers use my own direct register writes and reads for SPI. Please let me know how to do this in MQX, if possible.

Thanks

M

Tags (2)
1 Reply

371 Views
Symbolic
Contributor III

What you are asking for is (basically) to write your own driver..

Be warned that this is not a trivial task, but there is nothing stopping you from doing so.

The source code for the existing drivers is part of the MQX package.

Simply start by defining the register addresses, and do reads and writes to/from them.

You can look at the MQX drivers to see how different parts of this are done.

There is, in fact, nothing stopping you from calling any of the lower level routines that are in the code, if you can decipher what parameters, etc., need to be presented to them.

You can (and I have done this in the past) write a driver within the application code without going into the MQX drivers at all.

This is possible due to the fact that MQX applications are compiled and linked together with the OS routines, and all run (optionally, and by default) at supervisor privilege level.

You can also (but be careful with this - especially including the option to restore the original code) make your own custom modifications to the supplied driver routines.

If you do that, you have to re-build the bsp, psp, and possibly the other components of  MQX before your changes become applicable.

My experiences with this are on the Kinetis platforms.  If you are using a different processor family, the answers may not be correct.  (But probably are)

0 Kudos