Hi,
I have some trouble with the DWS3000 (with DW3110 on it).
2 of 3 Boards I bought do not reply with a valid device ID.
My wake up sequence: (like in the simple tx example)
- pull down the reset line for 50 ms
- wait 2 ms
- wait till chip reaches IDLE_RC state by checking if “dwt_checkidlerc()” returns true
- call “dwt_initialise(DWT_DW_INIT)”
The main function of my code
//runs in Zepyhr RTOS
//printk: debug output on UART
//k_msleep: sleep for x miliseconds
void main(void)
{
/* startup messages */
printk("*** Starting %s %s ***\n", FIRMWARE_NAME, GIT_VERSION);
#ifdef WITH_SYSTEM_VERSION_H
printk("*** Part of %s %s ***\n", SYSTEM_NAME, SYSTEM_GIT_VERSION);
#endif /* WITH_SYSTEM_VERSION_H */
/* init UART */
uart_dev = device_get_binding(UART_DEVICE);
if (!uart_dev) {
printk("UART: Device driver not found.\n");
return;
}
/* init SPI */
spi_dev = device_get_binding(SPI_DEVICE);
if (!spi_dev) {
printk("SPI: Device driver not found.\n");
return;
}
spi_cs_gpio = device_get_binding(SPI_CS_DEVICE);
gpio_pin_configure(spi_cs_gpio, SPI_CS_PIN, GPIO_OUTPUT_HIGH); /* inits CS to high */
spi_cfg.operation = SPI_WORD_SET(8) | SPI_TRANSFER_MSB | SPI_OP_MODE_MASTER;
spi_cfg.frequency = 10000000U;
/* init DW1000 */
reset_DW1000();
k_msleep(2);
while (!dwt_checkidlerc()) /* Need to make sure DW IC is in IDLE_RC before proceeding */
{
printk(".");
k_msleep(10);
};
if (dwt_initialise(DWT_DW_INIT) == DWT_SUCCESS) {
printk("Decawave init successful.\n");
} else {
printk("Decawave init failed.\n");
}
uint32_t id = dwt_readdevid();
printk("Decawave ID: %x\n", id);
//uint32_t test = dwt_read32bitoffsetreg(SEQ_CTRL_ID, 0);
//printk("SEQ_CTRL_ID = %u\n", test);
return; //will stop the thread
}
One of the chips responds with “deca0302” as device ID.
The other two chips do not reach the IDLE_RC state. If I skip the check for IDLE_RC state they respond with “6fe50101” as device ID. Then the dwt_initialise(DWT_DW_INIT) call returns DWT_ERROR.
I verified all SPI communication with a logic analyzer:
trace with the working chip
name | type | start_time | duration | mosi | miso |
---|---|---|---|---|---|
SPI | enable | 0.00209885 | 1.99999999e-09 | ||
SPI | result | 0.002102622 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.00210893 | 1.202e-06 | 0x00 | 0x02 |
SPI | result | 0.002111332 | 1.2e-06 | 0x00 | 0x03 |
SPI | result | 0.00211357 | 1.202e-06 | 0x00 | 0xCA |
SPI | result | 0.002115812 | 1.2e-06 | 0x00 | 0xDE |
SPI | disable | 0.002119928 | 2e-09 | ||
SPI | enable | 0.00212152 | 1.99999999e-09 | ||
SPI | result | 0.00212317 | 1.202e-06 | 0xD6 | 0x00 |
SPI | result | 0.00212557 | 1.202e-06 | 0x20 | 0x00 |
SPI | result | 0.00212781 | 1.202e-06 | 0x01 | 0x00 |
SPI | result | 0.002130052 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002134168 | 1.99999999e-09 | ||
SPI | enable | 0.002134918 | 2e-09 | ||
SPI | result | 0.00213655 | 1.202e-06 | 0xD6 | 0x00 |
SPI | result | 0.00213895 | 1.202e-06 | 0x10 | 0x00 |
SPI | result | 0.00214119 | 1.202e-06 | 0x04 | 0x00 |
SPI | result | 0.00214343 | 1.202e-06 | 0x00 | 0x00 |
SPI | disable | 0.002147554 | 1.99999988e-09 | ||
SPI | enable | 0.002148268 | 1.99999988e-09 | ||
SPI | result | 0.00214987 | 1.202e-06 | 0xD6 | 0x00 |
SPI | result | 0.00215227 | 1.202e-06 | 0x20 | 0x00 |
SPI | result | 0.00215451 | 1.202e-06 | 0x02 | 0x00 |
SPI | result | 0.00215675 | 1.202e-06 | 0x00 | 0x00 |
SPI | disable | 0.002160844 | 2.00000011e-09 | ||
SPI | enable | 0.002161478 | 1.99999988e-09 | ||
SPI | result | 0.00216313 | 1.202e-06 | 0x56 | 0x00 |
SPI | result | 0.00216553 | 1.202e-06 | 0x40 | 0x00 |
SPI | result | 0.00217128 | 1.202e-06 | 0x00 | 0x08 |
SPI | result | 0.00217368 | 1.202e-06 | 0x00 | 0x98 |
SPI | result | 0.00217592 | 1.202e-06 | 0x00 | 0x88 |
SPI | result | 0.00217816 | 1.202e-06 | 0x00 | 0x88 |
SPI | disable | 0.002182238 | 1.99999999e-09 | ||
SPI | enable | 0.002183204 | 1.99999999e-09 | ||
SPI | result | 0.00218488 | 1.202e-06 | 0xD6 | 0x00 |
SPI | result | 0.00218728 | 1.202e-06 | 0x20 | 0x00 |
SPI | result | 0.00218952 | 1.202e-06 | 0x01 | 0x00 |
SPI | result | 0.00219176 | 1.202e-06 | 0x00 | 0x00 |
SPI | disable | 0.002195924 | 1.99999999e-09 | ||
SPI | enable | 0.002196574 | 1.99999999e-09 | ||
SPI | result | 0.00219819 | 1.202e-06 | 0xD6 | 0x00 |
SPI | result | 0.00220059 | 1.202e-06 | 0x10 | 0x00 |
SPI | result | 0.00220283 | 1.202e-06 | 0x05 | 0x00 |
SPI | result | 0.00220507 | 1.202e-06 | 0x00 | 0x00 |
SPI | disable | 0.002209194 | 2.00000011e-09 | ||
SPI | enable | 0.002209854 | 2e-09 | ||
SPI | result | 0.00221145 | 1.202e-06 | 0xD6 | 0x00 |
SPI | result | 0.00221385 | 1.202e-06 | 0x20 | 0x00 |
SPI | result | 0.00221609 | 1.202e-06 | 0x02 | 0x00 |
SPI | result | 0.00221833 | 1.202e-06 | 0x00 | 0x00 |
SPI | disable | 0.002222408 | 1.99999999e-09 | ||
SPI | enable | 0.002223064 | 2.00000011e-09 | ||
SPI | result | 0.00222466 | 1.202e-06 | 0x56 | 0x00 |
SPI | result | 0.00222706 | 1.202e-06 | 0x40 | 0x00 |
SPI | result | 0.00223283 | 1.202e-06 | 0x00 | 0x19 |
SPI | result | 0.00223523 | 1.202e-06 | 0x00 | 0x88 |
SPI | result | 0.00223747 | 1.202e-06 | 0x00 | 0x09 |
SPI | result | 0.00223971 | 1.202e-06 | 0x00 | 0x08 |
SPI | disable | 0.002243788 | 1.99999999e-09 | ||
SPI | enable | 0.002244714 | 1.99999988e-09 | ||
SPI | result | 0.00224632 | 1.202e-06 | 0xD6 | 0x00 |
SPI | result | 0.00224872 | 1.202e-06 | 0x20 | 0x00 |
SPI | result | 0.00225096 | 1.202e-06 | 0x01 | 0x00 |
SPI | result | 0.0022532 | 1.202e-06 | 0x00 | 0x00 |
SPI | disable | 0.002257304 | 1.99999999e-09 | ||
SPI | enable | 0.002257974 | 2.00000011e-09 | ||
SPI | result | 0.00225957 | 1.202e-06 | 0xD6 | 0x00 |
SPI | result | 0.00226197 | 1.202e-06 | 0x10 | 0x00 |
SPI | result | 0.00226421 | 1.202e-06 | 0x0A | 0x00 |
SPI | result | 0.00226645 | 1.202e-06 | 0x00 | 0x00 |
SPI | disable | 0.002270574 | 2.00000011e-09 | ||
SPI | enable | 0.002271258 | 2.00000011e-09 | ||
SPI | result | 0.00227286 | 1.2e-06 | 0xD6 | 0x00 |
SPI | result | 0.00227526 | 1.202e-06 | 0x20 | 0x00 |
SPI | result | 0.0022775 | 1.202e-06 | 0x02 | 0x00 |
SPI | result | 0.00227974 | 1.202e-06 | 0x00 | 0x00 |
SPI | disable | 0.002283818 | 1.99999988e-09 | ||
SPI | enable | 0.002284508 | 1.99999999e-09 | ||
SPI | result | 0.00228613 | 1.202e-06 | 0x56 | 0x00 |
SPI | result | 0.00228853 | 1.202e-06 | 0x40 | 0x00 |
SPI | result | 0.00229425 | 1.202e-06 | 0x00 | 0x13 |
SPI | result | 0.00229665 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.00229889 | 1.202e-06 | 0x00 | 0x14 |
SPI | result | 0.00230113 | 1.202e-06 | 0x00 | 0x00 |
SPI | disable | 0.002305208 | 1.99999988e-09 | ||
SPI | enable | 0.002306348 | 1.99999999e-09 | ||
SPI | result | 0.00230793 | 1.202e-06 | 0xD6 | 0x00 |
SPI | result | 0.00231033 | 1.202e-06 | 0x22 | 0x00 |
SPI | result | 0.00231257 | 1.2e-06 | 0xFF | 0x00 |
SPI | result | 0.00231481 | 1.2e-06 | 0xFF | 0x00 |
SPI | result | 0.00231705 | 1.202e-06 | 0x80 | 0x00 |
SPI | result | 0.00231929 | 1.202e-06 | 0x01 | 0x00 |
SPI | disable | 0.002323218 | 1.99999999e-09 | ||
SPI | enable | 0.002323892 | 2.00000011e-09 | ||
SPI | result | 0.00232547 | 1.202e-06 | 0xE2 | 0x00 |
SPI | result | 0.00232787 | 1.2e-06 | 0x7E | 0x00 |
SPI | result | 0.00233011 | 1.202e-06 | 0xE0 | 0x00 |
SPI | result | 0.00233235 | 1.202e-06 | 0xFF | 0x00 |
SPI | result | 0.00233459 | 1.202e-06 | 0x14 | 0x00 |
SPI | result | 0.00233683 | 1.202e-06 | 0x00 | 0x00 |
SPI | disable | 0.002340788 | 2.00000011e-09 | ||
SPI | enable | 0.002341452 | 1.99999999e-09 | ||
SPI | result | 0.00234305 | 1.2e-06 | 0xD6 | 0x00 |
SPI | result | 0.00234545 | 1.2e-06 | 0x20 | 0x00 |
SPI | result | 0.00234769 | 1.2e-06 | 0x01 | 0x00 |
SPI | result | 0.00234993 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002354008 | 2.00000011e-09 | ||
SPI | enable | 0.002354678 | 1.99999988e-09 | ||
SPI | result | 0.00235628 | 1.2e-06 | 0xD6 | 0x00 |
SPI | result | 0.00235868 | 1.2e-06 | 0x10 | 0x00 |
SPI | result | 0.00236092 | 1.2e-06 | 0x20 | 0x00 |
SPI | result | 0.00236316 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002367282 | 1.99999988e-09 | ||
SPI | enable | 0.002367968 | 2.00000011e-09 | ||
SPI | result | 0.00236957 | 1.2e-06 | 0xD6 | 0x00 |
SPI | result | 0.00237197 | 1.2e-06 | 0x20 | 0x00 |
SPI | result | 0.00237421 | 1.2e-06 | 0x02 | 0x00 |
SPI | result | 0.00237645 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002380542 | 2.00000011e-09 | ||
SPI | enable | 0.002381172 | 1.99999988e-09 | ||
SPI | result | 0.00238277 | 1.2e-06 | 0x56 | 0x00 |
SPI | result | 0.00238517 | 1.2e-06 | 0x40 | 0x00 |
SPI | result | 0.00239092 | 1.2e-06 | 0x00 | 0x40 |
SPI | result | 0.00239332 | 1.2e-06 | 0x00 | 0x02 |
SPI | result | 0.00239556 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.0023978 | 1.2e-06 | 0x00 | 0x10 |
SPI | disable | 0.002401878 | 1.99999999e-09 | ||
SPI | enable | 0.002403108 | 1.99999999e-09 | ||
SPI | result | 0.00240474 | 1.2e-06 | 0xD6 | 0x00 |
SPI | result | 0.00240714 | 1.2e-06 | 0x20 | 0x00 |
SPI | result | 0.00240938 | 1.2e-06 | 0x01 | 0x00 |
SPI | result | 0.00241162 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002415762 | 1.99999999e-09 | ||
SPI | enable | 0.002416438 | 1.99999999e-09 | ||
SPI | result | 0.00241806 | 1.2e-06 | 0xD6 | 0x00 |
SPI | result | 0.00242046 | 1.2e-06 | 0x10 | 0x00 |
SPI | result | 0.0024227 | 1.2e-06 | 0x1F | 0x00 |
SPI | result | 0.00242494 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002429028 | 1.99999988e-09 | ||
SPI | enable | 0.002429688 | 1.99999999e-09 | ||
SPI | result | 0.0024313 | 1.2e-06 | 0xD6 | 0x00 |
SPI | result | 0.0024337 | 1.2e-06 | 0x20 | 0x00 |
SPI | result | 0.00243594 | 1.2e-06 | 0x02 | 0x00 |
SPI | result | 0.00243818 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002442258 | 2.00000011e-09 | ||
SPI | enable | 0.002442948 | 1.99999988e-09 | ||
SPI | result | 0.00244457 | 1.2e-06 | 0x56 | 0x00 |
SPI | result | 0.00244697 | 1.2e-06 | 0x40 | 0x00 |
SPI | result | 0.00245271 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.00245511 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.00245735 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.00245959 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002463668 | 1.99999999e-09 | ||
SPI | enable | 0.002464688 | 1.99999988e-09 | ||
SPI | result | 0.00246629 | 1.2e-06 | 0xD6 | 0x00 |
SPI | result | 0.00246869 | 1.2e-06 | 0x20 | 0x00 |
SPI | result | 0.00247093 | 1.2e-06 | 0x01 | 0x00 |
SPI | result | 0.00247317 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002477252 | 2.00000011e-09 | ||
SPI | enable | 0.002477928 | 1.99999988e-09 | ||
SPI | result | 0.00247955 | 1.2e-06 | 0xD6 | 0x00 |
SPI | result | 0.00248195 | 1.2e-06 | 0x10 | 0x00 |
SPI | result | 0.00248419 | 1.2e-06 | 0x1E | 0x00 |
SPI | result | 0.00248643 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002490552 | 1.99999999e-09 | ||
SPI | enable | 0.002491212 | 1.99999988e-09 | ||
SPI | result | 0.00249283 | 1.2e-06 | 0xD6 | 0x00 |
SPI | result | 0.00249523 | 1.2e-06 | 0x20 | 0x00 |
SPI | result | 0.00249747 | 1.2e-06 | 0x02 | 0x00 |
SPI | result | 0.00249971 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002503802 | 1.99999999e-09 | ||
SPI | enable | 0.002504488 | 1.99999988e-09 | ||
SPI | result | 0.00250608 | 1.2e-06 | 0x56 | 0x00 |
SPI | result | 0.00250848 | 1.2e-06 | 0x40 | 0x00 |
SPI | result | 0.00251422 | 1.2e-06 | 0x00 | 0x28 |
SPI | result | 0.00251662 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.00251886 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.0025211 | 1.2e-06 | 0x00 | 0x00 |
SPI | disable | 0.002525178 | 1.99999999e-09 | ||
SPI | enable | 0.002526212 | 1.99999999e-09 | ||
SPI | result | 0.002528 | 1.2e-06 | 0xD2 | 0x00 |
SPI | result | 0.0025304 | 1.2e-06 | 0x50 | 0x00 |
SPI | result | 0.00253264 | 1.2e-06 | 0x28 | 0x00 |
SPI | disable | 0.002536852 | 2.00000011e-09 | ||
SPI | enable | 0.004708436 | 2.00000011e-09 | ||
SPI | result | 0.004710072 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.004716052 | 1.2e-06 | 0x00 | 0x02 |
SPI | result | 0.004718452 | 1.2e-06 | 0x00 | 0x03 |
SPI | result | 0.004720692 | 1.2e-06 | 0x00 | 0xCA |
SPI | result | 0.004722932 | 1.2e-06 | 0x00 | 0xDE |
SPI | disable | 0.00472701 | 2.00000011e-09 |
trace with the non-working chip (skip the check for IDLE_RC state)
name | type | start_time | duration | mosi | miso |
---|---|---|---|---|---|
SPI | enable | 0.002098884 | 2.00000011e-09 | ||
SPI | result | 0.002102656 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.002108964 | 1.202e-06 | 0x00 | 0x01 |
SPI | result | 0.002111364 | 1.202e-06 | 0x00 | 0x01 |
SPI | result | 0.002113604 | 1.202e-06 | 0x00 | 0xE5 |
SPI | result | 0.002115844 | 1.202e-06 | 0x00 | 0x6F |
SPI | disable | 0.002119962 | 1.99999999e-09 | ||
SPI | enable | 0.003944932 | 2.00000011e-09 | ||
SPI | result | 0.003946518 | 1.2e-06 | 0x00 | 0x00 |
SPI | result | 0.003952508 | 1.2e-06 | 0x00 | 0x01 |
SPI | result | 0.003954908 | 1.2e-06 | 0x00 | 0x01 |
SPI | result | 0.003957148 | 1.2e-06 | 0x00 | 0xE5 |
SPI | result | 0.003959388 | 1.202e-06 | 0x00 | 0x6F |
SPI | disable | 0.003963466 | 1.99999999e-09 |
Is there something missing in my weak up sequence?