Problem with double buffer

[color=black]Hi All,[/color]
[color=black]I’m working on STM32F103, and I’m using double buffer to validate TDOA[/color] [color=black]algorithm. Label communication frequency is 0.5Hz. But for my anchor, after one or two interrupts are generated, it is no longer generated. And the SYS_STATUS_ID value is 0xFFFFFFFF.[/color]
[color=black]When I receive data using polling, I can receive it all. The relevant code is [/color]
[color=black]while(!((u32_reg_stat = dwt_read32bitreg(SYS_STATUS_ID)) & (SYS_STATUS_RXFCG | SYS_STATUS_ALL_RX_ERR | SYS_STATUS_RXOVRR)))[/color]
[color=black]{ };[/color]
[color=black][color=black]if(u32_reg_stat & SYS_STATUS_RXFCG)[/color]
[/color]
[color=black]{[/color]

[color=black]// Clear all receive status bits[/color]

[color=black]….[/color]

[color=black]}[/color]

[color=black]if(u32_reg_stat & SYS_STATUS_RXOVRR)[/color]

[color=black]{[/color]

[color=black]// Clear rx overrun status bits[/color]

[color=black]….[/color]

[color=black]}[/color]

[color=black]if(u32_reg_stat & SYS_STATUS_ALL_RX_ERR)[/color]

[color=black]{[/color]

[color=black]// Clear all error status bits[/color]

[color=black]….[/color]
[color=black][color=black]}[/color][/color]
[color=black]…[/color]
[color=black]I have read a few threads on this topic on the forum. For example, [/color]
[color=black][color=black]https://www.decawave.com/decaforum/showthread.php?tid=32&highlight=0xFFFFFFFF[/color][/color]
[color=black][color=black]https://www.decawave.com/decaforum/showthread.php?tid=1096&highlight=double[/color][/color]
[color=black][color=black]https://www.decawave.com/decaforum/showthread.php?tid=3&highlight=double[/color][/color]
[color=black]I confirm that my SPI is working properly. And my default communication configuration is,[/color]
[color=black]Channel [/color][color=black][size=x-small]5[/size][/color]
[color=black]RX/TX Code: 9[/color]
[color=black]PRF 64M[/color]
[color=black]Rate: 6.8M[/color]
[color=black]Preamble len[/color][color=black][size=x-small]gth[/size][/color][color=black]: [/color][color=black][size=x-small]256[/size][/color]
[color=black]PAC: [/color][color=black][size=x-small]16[/size][/color]
[color=black]standard SFD[/color]
[color=black]standard PHR mode[/color]
[color=black]no smart power[/color]
[color=black]PG delay 0xC[/color][color=black][size=x-small]0[/size][/color]
[color=black]power [/color][color=black][size=small]0x85858585[/size][/color]
[color=black] [/color]
[color=black][size=small]In addition, the interrupt related processing code is as follows,[/size][/color]

[color=black][size=small][color=black]u32_read_stat = dwt_read32bitreg(SYS_STATUS_ID);[/color]
[/size][/color]
[color=black]if(u32_read_stat & SYS_STATUS_RXFCG)[/color]

[color=black]{[/color]

[color=black]// Clear all receive status bits[/color]

[color=black]dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_GOOD); [/color]

[color=black]// Read frame info [/color]

[color=black]u16_finfo16 = dwt_read16bitoffsetreg(RX_FINFO_ID, 0);[/color]

[color=black]// Report frame length [/color]

[color=black]u32_frame_len = u16_finfo16 & RX_FINFO_RXFL_MASK_1023;[/color]

[color=black]//rx reenable[/color]

[color=black]dwt_rxenable(DWT_START_RX_IMMEDIATE | DWT_NO_SYNC_PTRS);[/color]

[color=black]// read rx data[/color]

[color=black]dwt_readrxdata(su8_dw1000_IRQ_rx_buf, u32_frame_len, 0);[/color]

[color=black]// Toggle the Host side Receive Buffer Pointer[/color]

[color=black]dwt_writetodevice(SYS_CTRL_ID, SYS_CTRL_HRBT_OFFSET, 1, &u8_ctrl_regval);[/color]

[color=black]}[/color]

[color=black]if(u32_read_stat & SYS_STATUS_TXFRS)[/color]

[color=black]{[/color]

[color=black]//tx data[/color]

[color=black]gb_dw1000_tx_irq = true;[/color]

[color=black]//Clear tx status bits[/color]

[color=black]}[/color]

[color=black]if(u32_read_stat & SYS_STATUS_RXOVRR) [/color]

[color=black]{[/color]

[color=black]//Clear rx overrun status bit[/color]

[color=black]dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_RXOVRR);[/color]

[color=black]//[/color] [color=black]turn off the transceiver[/color]

[color=black]dwt_forcetrxoff();[/color]

[color=black]//[/color] [color=black]resets the receiver[/color]

[color=black]dwt_rxreset();[/color]

[color=black]//rx reenable[/color]

[color=black]dwt_rxenable(DWT_START_RX_IMMEDIATE);[/color]

[color=black]}[/color]

[color=black]if(u32_read_stat & SYS_STATUS_ALL_RX_ERR)[/color]

[color=black]{[/color]

[color=black]//Clear error bits[/color]

[color=black]//[/color] [color=black]turn off the transceiver[/color]

[color=black]//[/color] [color=black]resets the receiver[/color]

[color=black]//rx reenable[/color]

[color=black]}[/color]

[color=black] [/color]

[color=black]Where is the problem with my code? Please give some advice.[/color]

[color=black]Thanks.[/color]
[color=black][size=small][color=black]Andrew[/color][/size][/color]

Hi Andrew
Does the system works ok if you disable double buffer, i.e. just use single buffer … doe you see any issues? If you could reproduce the issue with single buffer it would be easier to debug.

/Leo

Hi DecaLeo,
Thanks for your reply. Several days ago, I post a thread about single buffer.
https://www.decawave.com/decaforum/showthread.php?tid=1101
But nobody reply.

Just now, I try it again with single buffer. It works abnormally. The SYS_STATUS_ID is also 0xFFFFFFFF. I have read some similar threads on the forum, but I am still not sure about the issue.

Best regards,
Andrew

The SYS_STATUS_ID is also 0xFFFFFFFF.

This means the DW IC is not operating correctly, e.g. in could be in DEEP SLEEP mode … in you case the SPI comms are not functional any more, you need to figure out after which event/how does the DW IC get into this state?

Z

Hi zoran,

Thank you for your advice. I will read my code carefully and try to find the issue.

Best regards,
Andrew

Hi Leo and zoran,

Thanks for your help. Two weeks ago, I found the bug. Since I used the old version of the SDK, I set up the HSRBP twice. After the modification, the program runs normally.

But now, when I using three DW1000 send message to the other DW1000, it can only receive two messages.

In the thread, https://www.decawave.com/decaforum/showthread.php?tid=32&highlight=0xFFFFFFFF
it said the DW1000 can receive all messages.

What could be the reason about the issue?
Do I need to add a delay time before transfer the message?
If need to add a delay time, how much is appropriate?

Thanks,
Best regards,
Andrew

Are you getting overrun?

You can just send a single message, then process this in the other DW, then toggle the buffer and then send the next message, then process this and toggle the buffer again… once you are happy the buffers are toggling correctly and you are processing the data correctly, speed up the whole system.

Hi zoran,

Thanks for your reply. When I used three dw1000 to send message to the other dw1000, it didn’t appear overrun.

Now,I am using one dw1000 send message, the anchors can process the data correctly.

In fact, when I using many tags(for example 20 tags) to send message to anchors, I want to know how to avoid message reception conflicts and message loss.

Thank you,
Best regards,
Andrew

If you have multiple devices transmitting at the same time (2 or more devices), the only way to remove interference is to use time slotting, i.e. have only one device transmit at any one time. E.g. Decawave’s TREK demo uses TDMA to divide time into slots and only single tag is active in any one slot.

Overlapping transmissions will give rise to incorrect timestamps (e.g. overlapping preambles from tags which have close clock freq can cause wrong first path estimates), or missed messages.

In some solutions/systems this interference can be ok, the system can deal with it at higher level, filter out wrong results.

Hi zoran,

Thank you for your detailed introduction. I will read the relevant materials you introduced, as well as other relevant documents, and strive to master them as soon as possible.

I really do appreciate what your reply.
Best regards,
Andrew