Using SPI1 to Interface Accelerometer on K20 MQX...

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

Using SPI1 to Interface Accelerometer on K20 MQX...

Jump to solution
1,009 Views
blow_the_whistl
Contributor I

I'm trying to hook up an external Accelerometer via the K20 tower board + Proto board peripheral card wired to accelerometer.

I tried to follow the example under MQX, whereby the tower talks to an EEPROM through SPI0.  I basically ported this example over to SPI1 and changed the code to just try and write a few simple accelerometer commands.

The problem is I can't even see the SCLK or Chip Select on a scope.  It seems that maybe the pin mux is wrong, so I modified init_gpio.c under BSP to follow our pinmux (using K20 Port B 11, 12, 13, 17 ATL2).  Still no function.

Is there a simple example of using SPI1 port to read and write (preferably without MQX, but MQX would be helpful too).

Is there a straight forward document regarding changing PINMUX in the BSP (SPI1 Port B in my case).

Thanks!

Labels (1)
Tags (4)
1 Solution
430 Views
blow_the_whistl
Contributor I

Yes, I had done that.  The problem ended up being that I needed to bridge connections for SPI 1 since I was using the peripheral board.  The K20 tower schematic leaves SCLK, SDIN, SDO, CS, etc OPEN, so needed to solder those connections together to make SPI work with the peripheral card on PORT B.

Also, since I was using PORT B instead of PORT C, I needed to modify the pinmux via init_gpio.c.

Thanks for the response.

View solution in original post

0 Kudos
2 Replies
430 Views
alejandrolozan1
NXP Employee
NXP Employee

Are you using the TWR-K20D50M or the TWR-K20D72M?

Did you enable the correct driver in the user_config.h file?

For example, for the SPI 0 the below macro should be set to 1

#define BSPCFG_ENABLE_SPI0       0

The same for the rest of the needed modules.

After that you have to recompile the BSP.

431 Views
blow_the_whistl
Contributor I

Yes, I had done that.  The problem ended up being that I needed to bridge connections for SPI 1 since I was using the peripheral board.  The K20 tower schematic leaves SCLK, SDIN, SDO, CS, etc OPEN, so needed to solder those connections together to make SPI work with the peripheral card on PORT B.

Also, since I was using PORT B instead of PORT C, I needed to modify the pinmux via init_gpio.c.

Thanks for the response.

0 Kudos