Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dw1000_driver_freertos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Colin Wulf
dw1000_driver_freertos
Commits
89222978
Commit
89222978
authored
9 years ago
by
Keno Garlichs
Browse files
Options
Downloads
Patches
Plain Diff
merged colin's lates changes to the dw1000 driver
parent
0c235b04
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Inc/dw1000.h
+4
-1
4 additions, 1 deletion
Inc/dw1000.h
Src/dw1000.c
+44
-6
44 additions, 6 deletions
Src/dw1000.c
Src/dw1000_isr.c
+5
-2
5 additions, 2 deletions
Src/dw1000_isr.c
with
53 additions
and
9 deletions
Inc/dw1000.h
+
4
−
1
View file @
89222978
...
@@ -3,13 +3,15 @@
...
@@ -3,13 +3,15 @@
#include
"FreeRTOS.h"
#include
"FreeRTOS.h"
#include
<stdint.h>
#include
<stdint.h>
#include
"cmsis_os.h"
#include
"cmsis_os.h"
#include
"dw1000_util.h"
#define MAXIMUM_FRAME_LENGTH 127
#define MAXIMUM_FRAME_LENGTH 127
#define FRAME_OVERHEAD sizeof(dw1000_frame_t) - MAXIMUM_FRAME_LENGTH
#define FRAME_OVERHEAD sizeof(dw1000_frame_t) - MAXIMUM_FRAME_LENGTH
/**
/**
* Defines for channel and prf selection and
p
reamble Code.
* Defines for channel and prf selection and
P
reamble Code.
* Refer to Page 204 in the dw1000 User Manual 2.04
* Refer to Page 204 in the dw1000 User Manual 2.04
*/
*/
#define PRF_SHIFT 0
#define PRF_SHIFT 0
...
@@ -131,6 +133,7 @@ typedef struct __attribute__((packed)){
...
@@ -131,6 +133,7 @@ typedef struct __attribute__((packed)){
uint8_t
rx_timestamp
[
5
];
uint8_t
rx_timestamp
[
5
];
uint16_t
length
;
uint16_t
length
;
uint8_t
buffer
[
MAXIMUM_FRAME_LENGTH
];
uint8_t
buffer
[
MAXIMUM_FRAME_LENGTH
];
}
dw1000_frame_t
;
}
dw1000_frame_t
;
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Src/dw1000.c
+
44
−
6
View file @
89222978
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
#include
"dw1000_isr.h"
#include
"dw1000_isr.h"
#include
"deca_regs.h"
#include
"deca_regs.h"
#include
"dw1000_util.h"
#include
"dw1000_util.h"
#include
"stm32f4xx_hal.h"
#ifdef DEBUG
#ifdef DEBUG
#include
"Trace.h"
#include
"Trace.h"
#endif
#endif
...
@@ -256,6 +258,30 @@ int dw1000_sendFrame(uint8_t *frame, uint16_t frame_length) {
...
@@ -256,6 +258,30 @@ int dw1000_sendFrame(uint8_t *frame, uint16_t frame_length) {
}
}
/*
int dw1000_sendDelayedFrame(uint8_t *payload, uint16_t len, node_time_t tx_time) {
//Write payload to buffer
int ret = dw1000_writeFrameIntoBuffer(0, payload, len);
// Write desired tx time to register
dw1000Hal_writeSubRegister(DX_TIME_ID, 0, (uint8_t *)&tx_time, DX_TIME_LEN);
// Force receiver off
dw1000Util_forceTrxOff();
// Trigger delayed sending by setting TXSTART and TXDLYS
uint8_t temp = (uint8_t) SYS_CTRL_TXSTRT | SYS_CTRL_TXDLYS;
dw1000Hal_writeRegister(SYS_CTRL_ID, &temp, 1);
// Re-enable receiver
dw1000Util_enableRX();
return ret;
}
*/
/**
/**
* See header file dw1000.h
* See header file dw1000.h
*/
*/
...
@@ -290,8 +316,10 @@ int dw1000_transmitFrame(uint16_t tx_buffer_offset, uint16_t frame_length) {
...
@@ -290,8 +316,10 @@ int dw1000_transmitFrame(uint16_t tx_buffer_offset, uint16_t frame_length) {
/* WITHOUT THE NEXT PART: SECOND TIME NO SENDING POSSIBLE, BUT CAN'T BE FOUND IN ORIGINAL DRIVER */
/* WITHOUT THE NEXT PART: SECOND TIME NO SENDING POSSIBLE, BUT CAN'T BE FOUND IN ORIGINAL DRIVER */
dw1000Util_forceTrxOff
();
dw1000Util_forceTrxOff
();
uint8_t
temp
=
(
uint8_t
)
SYS_CTRL_TXSTRT
;
uint8_t
temp
=
(
uint8_t
)
SYS_CTRL_TXSTRT
;
dw1000Hal_writeRegister
(
SYS_CTRL_ID
,
(
uint8_t
*
)
&
temp
,
1
);
HAL_GPIO_WritePin
(
GPIOD
,
GPIO_PIN_11
,
GPIO_PIN_SET
);
dw1000Hal_writeRegister
(
SYS_CTRL_ID
,
(
uint8_t
*
)
&
temp
,
1
);
HAL_GPIO_WritePin
(
GPIOD
,
GPIO_PIN_11
,
GPIO_PIN_RESET
);
return
DW1000_RET_OK
;
return
DW1000_RET_OK
;
}
}
...
@@ -302,12 +330,22 @@ int dw1000_transmitFrame(uint16_t tx_buffer_offset, uint16_t frame_length) {
...
@@ -302,12 +330,22 @@ int dw1000_transmitFrame(uint16_t tx_buffer_offset, uint16_t frame_length) {
void
dw1000_receiveFrameFromIsr
(
dw1000_frame_t
*
frame
)
{
void
dw1000_receiveFrameFromIsr
(
dw1000_frame_t
*
frame
)
{
frame
->
length
=
dw1000local
.
frame_length
;
frame
->
length
=
dw1000local
.
frame_length
;
frame
->
timestamp_valid
=
dw1000local
.
timestamp_valid
;
frame
->
timestamp_valid
=
dw1000local
.
timestamp_valid
;
if
(
frame
->
timestamp_valid
)
{
if
(
frame
->
timestamp_valid
){
dw1000Util_getRxTimestamp
((
uint
8
_t
*
)
&
frame
->
rx_timestamp
);
dw1000Util_getRxTimestamp
((
uint
64
_t
*
)
&
frame
->
rx_timestamp
);
}
}
dw1000Hal_readRegisterFromIsr
(
RX_BUFFER_ID
,
frame
->
buffer
,
frame
->
length
);
//FromIsr important!
dw1000Hal_readRegisterFromIsr
(
RX_BUFFER_ID
,
frame
->
buffer
,
frame
->
length
);
//FromIsr important!
}
}
int
dw1000_setPanAddr
(
uint16_t
addr
)
{
return
dw1000Hal_writeSubRegister
(
PANADR_ID
,
PANADR_SHORT_ADDR_OFFSET
,
(
uint8_t
*
)
&
addr
,
PANADR_SHORT_ADDR_LEN
);
}
int
dw1000_setPanId
(
uint16_t
addr
)
{
return
dw1000Hal_writeSubRegister
(
PANADR_ID
,
PANADR_PAN_ID_OFFSET
,
(
uint8_t
*
)
&
addr
,
PANADR_PAN_ID_LEN
);
}
/**
/**
* See header file dw1000.h
* See header file dw1000.h
*/
*/
...
@@ -330,8 +368,8 @@ void dw1000_generateConfig(uint16_t mode, dw1000_config_t *config, uint8_t fast)
...
@@ -330,8 +368,8 @@ void dw1000_generateConfig(uint16_t mode, dw1000_config_t *config, uint8_t fast)
//16MHz PRF
//16MHz PRF
config
->
pulse_repetition_frequency
=
DWT_PRF_16M
;
config
->
pulse_repetition_frequency
=
DWT_PRF_16M
;
}
}
//Fixme: How to calculate SFD Timeout
config
->
sfd_timeout
=
129
;
config
->
sfd_timeout
=
(
129
+
8
-
8
)
;
if
(
fast
==
2
)
{
if
(
fast
==
2
)
{
trace_printf
(
"Super fast
\n
"
);
trace_printf
(
"Super fast
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
Src/dw1000_isr.c
+
5
−
2
View file @
89222978
...
@@ -36,7 +36,9 @@ BaseType_t _handleTx(uint64_t * event, uint64_t * event_clear) {
...
@@ -36,7 +36,9 @@ BaseType_t _handleTx(uint64_t * event, uint64_t * event_clear) {
BaseType_t
_handleRx
(
uint64_t
*
event
,
uint64_t
*
event_clear
)
{
BaseType_t
_handleRx
(
uint64_t
*
event
,
uint64_t
*
event_clear
)
{
BaseType_t
higher_priority_task_woken
=
pdFALSE
;
BaseType_t
higher_priority_task_woken
=
pdFALSE
;
// Get frame length
//Fixme: Wann kann ein Overrun auftreten?
// Get get length
uint32_t
rx_frame_info
;
uint32_t
rx_frame_info
;
dw1000Hal_readRegisterFromIsr
(
RX_FINFO_ID
,
(
uint8_t
*
)
&
rx_frame_info
,
dw1000Hal_readRegisterFromIsr
(
RX_FINFO_ID
,
(
uint8_t
*
)
&
rx_frame_info
,
RX_FINFO_LEN
);
RX_FINFO_LEN
);
...
@@ -54,7 +56,8 @@ BaseType_t _handleRx(uint64_t * event, uint64_t * event_clear) {
...
@@ -54,7 +56,8 @@ BaseType_t _handleRx(uint64_t * event, uint64_t * event_clear) {
// Trigger callback or notify task
// Trigger callback or notify task
if
(
dw1000local
.
receive_callback
!=
NULL
)
{
if
(
dw1000local
.
receive_callback
!=
NULL
)
{
higher_priority_task_woken
=
dw1000local
.
receive_callback
();
higher_priority_task_woken
=
dw1000local
.
receive_callback
();
}
else
if
(
dw1000local
.
task_handle
!=
NULL
)
{
}
if
(
dw1000local
.
task_handle
!=
NULL
)
{
vTaskNotifyGiveFromISR
(
dw1000local
.
task_handle
,
&
higher_priority_task_woken
);
vTaskNotifyGiveFromISR
(
dw1000local
.
task_handle
,
&
higher_priority_task_woken
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment