Hello,
I hope someone can help me.
I am trying to communicate with a port expander (MAX7301AAX) via 4-wire SPI. Although I am absolutely sure to
send the right commands, I am not able to set a port.
My SPI configs are:
SpibRegs.SPICCR.bit.SPISWRESET=0; // Reset SPI
SpibRegs.SPICCR.all=0x000F; // CPOL = 0; 16bit mode //0x004F
SpibRegs.SPICTL.all=0x000F; // CPHA = 1; Master mode; TX enable, Interrupts disable //
SpibRegs.SPISTS.all=0x0000; // 00000: no receive overrun occured; no full words received/transmitted; transmit buffer not full;
SpibRegs.SPIBRR.all=0x0063; // 1100011: SPICLK = LSPCLK / 100 = 500 kHz
SpibRegs.SPIFFTX.all=0xC022; // 1100000000100010: reset fifo; enable interrupt; interrupt at 2 words or fewer Enable FIFO's
SpibRegs.SPIFFRX.all=0x0022; // 100010: enable interrupt; interrupt at two or more words
SpibRegs.SPIFFCT.all=0x0002; // : 2 clocks delay
SpibRegs.SPIPRI.all=0x0010; // free run
SpibRegs.SPICCR.bit.SPISWRESET=1; // Enable SPI
SpibRegs.SPIFFTX.bit.TXFIFO=1;
SpibRegs.SPIFFRX.bit.RXFIFORESET=1;
I also observed the DIN Pin with a oscilloscope but could not find anything wrong. I tried CPHA = 0 and CPHA = 1, without success.
My init sequence is:
1.) Wakeup from shutdown --> send 0x0401;
2.) Config Port 4 to 7 as output --> send 0x0955;
3.) Set Port 4 to 7 high--> 0x40FF;
No matter what I try, Port 4 never becomes high. I don't know what I a doing wrong.
I hope someone can give me a hint.
I am looking forward to your answer(s).
Kindly regards.
Werner