Using SPI1 to Interface Accelerometer on K20 MQX...

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Using SPI1 to Interface Accelerometer on K20 MQX...

ソリューションへジャンプ
1,025件の閲覧回数
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!

ラベル(1)
タグ(4)
1 解決策
446件の閲覧回数
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 件の賞賛
2 返答(返信)
446件の閲覧回数
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.

447件の閲覧回数
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 件の賞賛