Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sponsored by ARK] Bidirectional DShot #23863

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions boards/ark/fmu-v6x/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@
/* This board provides a DMA pool and APIs */
#define BOARD_DMA_ALLOC_POOL_SIZE 5120

/* This board has 4 DMA channels available for bidirectional dshot */
#define BOARD_DMA_NUM_DSHOT_CHANNELS 4

/* This board provides the board_on_reset interface */

#define BOARD_HAS_ON_RESET 1
Expand Down
3 changes: 3 additions & 0 deletions boards/ark/fpv/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@
/* This board provides a DMA pool and APIs */
#define BOARD_DMA_ALLOC_POOL_SIZE 5120

/* This board has 3 DMA channels available for bidirectional dshot */
#define BOARD_DMA_NUM_DSHOT_CHANNELS 3

/* This board provides the board_on_reset interface */

#define BOARD_HAS_ON_RESET 1
Expand Down
2 changes: 1 addition & 1 deletion boards/ark/fpv/src/timer_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
constexpr io_timers_t io_timers[MAX_IO_TIMERS] = {
initIOTimer(Timer::Timer5, DMA{DMA::Index1}),
initIOTimer(Timer::Timer8, DMA{DMA::Index1}),
initIOTimer(Timer::Timer4, DMA{DMA::Index1}),
initIOTimer(Timer::Timer4),
};

constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
Expand Down
3 changes: 3 additions & 0 deletions boards/ark/pi6x/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@
/* This board provides a DMA pool and APIs */
#define BOARD_DMA_ALLOC_POOL_SIZE 5120

/* This board has 4 DMA channels available for bidirectional dshot */
#define BOARD_DMA_NUM_DSHOT_CHANNELS 4

/* This board provides the board_on_reset interface */

#define BOARD_HAS_ON_RESET 1
Expand Down
13 changes: 13 additions & 0 deletions platforms/nuttx/src/px4/nxp/imxrt/dshot/dshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,19 @@ void up_bdshot_erpm(void)
}


int up_bdshot_num_erpm_ready(void)
{
int num_ready = 0;

for (unsigned i = 0; i < DSHOT_TIMERS; ++i) {
if (bdshot_parsed_recv_mask & (1 << i)) {
++num_ready;
}
}

return num_ready;
}


int up_bdshot_get_erpm(uint8_t channel, int *erpm)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ __EXPORT int io_timer_free_channel(unsigned channel);
__EXPORT int io_timer_get_channel_mode(unsigned channel);
__EXPORT int io_timer_get_mode_channels(io_timer_channel_mode_t mode);
__EXPORT extern void io_timer_trigger(void);
__EXPORT void io_timer_update_dma_req(uint8_t timer, bool enable);

__EXPORT extern int io_timer_set_dshot_mode(uint8_t timer, unsigned dshot_pwm_rate, uint8_t dma_burst_length);

/**
* Returns the pin configuration for a specific channel, to be used as GPIO output.
Expand Down
Loading
Loading