I am trying to control the GPIOs of DWM1000 but the read operation for example of register GPIO DIR returns 0xDEAD01FF.
The bytes on the wire are exactly:
MOSI 66 08 00 00 00 00
MISO 7F 00 FF 01 AD DE
I can communicate reliably with the module. Chip ID is correct (0xDECA0130). I can control other registers. I can read/write PMSC registers without problems. SPI clock is 2 MHz. Tracks are very short. Signal integrity looks okay.
I am using code based on ex_10a_gpio and decadriver:
if (dwt_initialise(DWT_LOADNONE) == DWT_ERROR) {
printf("INIT FAILED");
while (1) {}
}
dwt_enablegpioclocks();
dwt_setgpiodirection(DWT_GxM0 | DWT_GxM1 | DWT_GxM2, DWT_GxP0 | DWT_GxP1 | DWT_GxP2);
dwt_setgpiovalue(DWT_GxM0, DWT_GxP0); // no voltage appears on the pin
dwt_setgpiovalue(DWT_GxM1, DWT_GxP1); // no voltage appears on the pin
dwt_setgpiovalue(DWT_GxM2, DWT_GxP2); // no voltage appears on the pin
dwt_setgpiovalue(DWT_GxM3, DWT_GxP3); // no voltage appears on the pin
printf("reg dir %08X", dwt_read32bitoffsetreg(GPIO_CTRL_ID, GPIO_DIR_OFFSET)); // prints 0xDEAD01FF
printf("reg raw %08X", dwt_read32bitoffsetreg(GPIO_CTRL_ID, GPIO_RAW_OFFSET)); // prints 0xDE000000
while (1) {}
How can I debug this issue?
Thanks for help