How to configure the MWCT1012 SPI Drive

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to configure the MWCT1012 SPI Drive

814 次查看
hankzhang
Contributor I

Use WCT1012 mcu spi2(GPIOC6/7/8/9) function, How to configure the spi drive?  I usually configured the gpio clock,That is my SPI_Init function below:

void SPI_Init(void)
{
QSPI0_SPDSR = 0x0027U;//推挽 Tx RX CS软件输入 8bit传输

QSPI0_SPSCR = 0x82E0U;//32div MSB SlaveMode SCLK空闲高 第二个边沿发送 SPI使能 receiver interrupt

QSPI0_SPCTL2 = 0x01U;//开启hold off

QSPI0_SPDTR = 0xff; //默认发送0xff
}

Now my probelm is that function can not enter the SPI  ISR。

标签 (1)
标记 (1)
0 项奖励
2 回复数

676 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Hank,

First of all, you have to enable the SPI0 gated clock with the line before you write SPI0 regs:

SIM_PCE1|=1<<9;

you have to configure the pins as SPI0, it appears that you use GPIOC7/8/9/10 pins as SPIO0.

1)set the pins as SPIO0

GPIOC_PER|=0x780;

2)assign the pins as SPIO0:

SIM_GPSCL&=~(0xC000); //clear C7

Configure GPIO C7
00 Function = SS0_B; Peripheral = SPI0; Direction = IO
01 Function = TXD0; Peripheral = SCI0; Direction = IO
10 Function = XBIN_8; Peripheral = XBARA; Direction = IO
11 Reserved

SIM_GPSCH&=~(0x3F);

5–4 C10
Configure GPIO C10
00 Function = MOSI0; Peripheral = SPI0; Direction = IO
01 Function = XB_IN5; Peripheral = XBAR; Direction = IN
10 Function = MISO0; Peripheral = SPI0; Direction = IO
11 Function = XB_OUT9; Peripheral = XBAR; Direction = IN
3–2 C9
Configure GPIO C9
00 Function = SCLK0; Peripheral = SPI0; Direction = IO
01 Function = XB_IN4; Peripheral = XBAR; Direction = IN
10 Function = TXD0; Peripheral = SCI0; Direction = IO
11 Function = XB_OUT8; Peripheral = XBAR; Direction = IN
1–0 C8
Configure GPIO C8
00 Function = MISO0; Peripheral = SPI0; Direction = IO
01 Function = RXD0; Peripheral = SCI0; Direction = IN
10 Function = XB_IN9; Peripheral = XBAR; Direction = IN
11 Function = XB_OUT6; Peripheral = XBAR; Direction = OUT

Hope it can help you

BR

XiangJun Rong

0 项奖励

676 次查看
hankzhang
Contributor I

Thanks for your answer,I have configured the GPIO, Now  it works

0 项奖励