Skip to content
Snippets Groups Projects
Commit f40fcf28 authored by Colin Wulf's avatar Colin Wulf
Browse files

dw1000: added Util-Function for Timestamping, loaded LDE-Code from OTP-M and...

dw1000: added Util-Function for Timestamping, loaded LDE-Code from OTP-M and handled LDEDONE interrupt
parent 645a9f12
No related branches found
No related tags found
No related merge requests found
......@@ -86,6 +86,7 @@ uint32_t dw1000Util_otpread(uint32_t address);
void dw1000Util_forceTrxOff(void);
void dw1000Util_reset(void);
void dw1000Util_resetRxOnly(void);
void dw1000Util_getRxTimestamp(uint8_t * timeBuffer);
#ifdef DEBUG
......
......@@ -105,6 +105,14 @@ int dw1000_init(uint16_t config, BaseType_t (*sendCallback)(),
//FIXME: Sleep in FreeRTOS? Sleep(1); // Allow time for code to upload (should take up to 120 us)
osDelay(1);
wr_buf[1] = 0x02; //Force TX clock off.
wr_buf[0] = 0x00; //Force system clock to be the 19.2 MHz XTI clock.
//DECA:dwt_writetodevice(PMSC_ID, PMSC_CTRL0_OFFSET, 2, wr_buf);
dw1000Hal_writeSubRegister(PMSC_ID, PMSC_CTRL0_OFFSET, wr_buf, 2); //Just first 2 byte instead of whole crtl0
//default clocks (ENABLE_ALL_SEQ)
//DECA:enable clocks for sequencing
dw1000Util_enableclocks(ENABLE_ALL_SEQ);
......
......@@ -95,9 +95,15 @@ void dw1000Isr_handleInterrupt(void) {
// //trace_printf("SHIT\n");
// dw1000Hal_resetRxOnly();
// }
#ifdef DEBUG
hexdump(&event, 5);
#endif
if(event & SYS_STATUS_LDEDONE){
uint8_t time [5];
dw1000Util_getRxTimestamp(time);
hexdump(time,5);
}else if (event & SYS_STATUS_LDEERR){
trace_printf("HUEHEUE\n");
}else{
if (event & SYS_STATUS_TXFRS) { // Frame sent
event_clear |= SYS_STATUS_TXFRS; //clear interrupt
dw1000Hal_handleTx(event);
......@@ -127,6 +133,7 @@ void dw1000Isr_handleInterrupt(void) {
dw1000Util_enableRX();
}
}
}
// if (event & SYS_STATUS_RXDFR){ // Frame received
......
......@@ -257,6 +257,9 @@ uint32_t dw1000Util_otpread(uint32_t address)
return (ret_data);
}
void dw1000Util_getRxTimestamp(uint8_t * timeBuffer){
dw1000Hal_readSubRegisterFromIsr(RX_TIME_ID, RX_TIME_RX_STAMP_OFFSET, timeBuffer, RX_TIME_RX_STAMP_LEN);
}
void dw1000Util_forceTrxOff(void) {
uint32_t sys_ctrl = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment