Hello
I am new to SPI, I am using MQX 4.0.1. I am able to read Device ID and manufacturer ID from the SPI module.
But my further Write and Read from SPI seems to be not working. I use the SPI example from mqx. I am working on
a custom board with MK60DN512VLL10 MCU on board. In init_gpio.c, I changed DSPI2 code as follows,
pctl = (PORT_MemMapPtr)PORTB_BASE_PTR;
pctl->PCR[20] = PORT_PCR_MUX(2); /* DSPI2.PCS0 */
pctl->PCR[21] = PORT_PCR_MUX(2); /* DSPI2.SCK */
pctl->PCR[22] = PORT_PCR_MUX(2); /* DSPI2.SOUT */
pctl->PCR[23] = PORT_PCR_MUX(2); /* DSPI2.SIN */
H/W signals are fine that we have checked them with scope.
and example output is as folows:-
0xbf 0x48 0xbf 0x48
Read memory status ... 0x0c
Enable write latch in memory ... OK
Read memory status ... 0x0e
Write unprotect memory ... OK
Enable write latch in memory ... OK
Read memory status ... 0x0e
Write unprotect memory ... OK
Enable write latch in memory ... OK
Read memory status ... 0x0e
Erase whole memory chip:
Read memory status ... 0x0c
Erase chip ... OK
Enable write latch in memory ... OK
Read memory status ... 0x0e
Write byte 0xba to location 0x000000f0 in memory ... done 0xba
Read memory status ... 0x0c
Read byte from location 0x000000f0 in memory ... 0xff
Byte test ... ERROR
Getting statistics:
Rx packets: 16
Tx packets: 49
This is what I get in the console ser port. "0xbf 0x48 0xbf 0x48" is the device ID i get when read.
NOTE: In our H/W ChipSelect and WriteProtect pins of the slave device are pulled up so It always remain High.
Please help me with this. What does "Callback" and "WP_HOLD" do? and is it need to be programmable to make SPI work?