Skip to content

Commit

Permalink
Merge branch 'master' into revl_troubleshooting
Browse files Browse the repository at this point in the history
Merge with master.
  • Loading branch information
corruptbear committed Sep 11, 2023
2 parents add5056 + d5c1e51 commit b438772
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion software/firmware/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1349187344451287604" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1424646437403787802" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
16 changes: 10 additions & 6 deletions software/firmware/src/boards/revL/pinout.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@
#define PIN_RADIO_SPI_MISO 33
#define PIN_RADIO_SPI_MOSI 32
#define PIN_RADIO_SPI_CS 29
#define PIN_RADIO_SPI_CS2 24
#define PIN_RADIO_SPI_CS3 25
#define PIN_RADIO_INTERRUPT 27
#define PIN_RADIO_INTERRUPT2 51
#define PIN_RADIO_INTERRUPT3 79
#define PIN_RADIO_RESET 50
#define PIN_RADIO_WAKEUP 26
#define PIN_RADIO_ANTENNA_SELECT1 24
#define PIN_RADIO_ANTENNA_SELECT2 25
#define PIN_RADIO_WAKEUP2 53
#define PIN_RADIO_WAKEUP3 88
#define PIN_RADIO_SPI_SCK_FUNCTION AM_HAL_PIN_31_M3SCK
#define PIN_RADIO_SPI_MISO_FUNCTION AM_HAL_PIN_33_M3MISO
#define PIN_RADIO_SPI_MOSI_FUNCTION AM_HAL_PIN_32_M3MOSI
Expand All @@ -45,10 +49,10 @@
#define PIN_IMU_RESET 65

// LEDs
#define PIN_LED1_RED 52
#define PIN_LED1_GREEN 51
#define PIN_LED2_RED 76
#define PIN_LED2_YELLOW 88
#define PIN_LED1_RED 11 // INCORRECT MAPPING DUE TO SHARED PINS
#define PIN_LED1_GREEN 12 // INCORRECT MAPPING DUE TO SHARED PINS
#define PIN_LED2_RED 15 // INCORRECT MAPPING DUE TO SHARED PINS
#define PIN_LED2_YELLOW 16 // INCORRECT MAPPING DUE TO SHARED PINS

// Logging
#define PIN_SWO 3
Expand Down
29 changes: 29 additions & 0 deletions software/firmware/src/peripherals/src/ranging.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,25 @@ void ranging_radio_init(uint8_t *uid)
// Set up the DW3000 wake-up pin as an output, initially set to low
configASSERT0(am_hal_gpio_pinconfig(PIN_RADIO_WAKEUP, am_hal_gpio_pincfg_output));
am_hal_gpio_output_clear(PIN_RADIO_WAKEUP);
#if REVISION_ID >= REVISION_L
configASSERT0(am_hal_gpio_pinconfig(PIN_RADIO_WAKEUP2, am_hal_gpio_pincfg_output));
am_hal_gpio_output_clear(PIN_RADIO_WAKEUP2);
configASSERT0(am_hal_gpio_pinconfig(PIN_RADIO_WAKEUP3, am_hal_gpio_pincfg_output));
am_hal_gpio_output_clear(PIN_RADIO_WAKEUP3);
#endif

// Set up the DW3000 antenna selection pins
#if REVISION_ID < REVISION_L
configASSERT0(am_hal_gpio_pinconfig(PIN_RADIO_ANTENNA_SELECT1, am_hal_gpio_pincfg_output));
am_hal_gpio_output_clear(PIN_RADIO_ANTENNA_SELECT1);
configASSERT0(am_hal_gpio_pinconfig(PIN_RADIO_ANTENNA_SELECT2, am_hal_gpio_pincfg_output));
am_hal_gpio_output_clear(PIN_RADIO_ANTENNA_SELECT2);
#else
configASSERT0(am_hal_gpio_pinconfig(PIN_RADIO_SPI_CS2, am_hal_gpio_pincfg_output));
am_hal_gpio_output_set(PIN_RADIO_SPI_CS2);
configASSERT0(am_hal_gpio_pinconfig(PIN_RADIO_SPI_CS3, am_hal_gpio_pincfg_output));
am_hal_gpio_output_set(PIN_RADIO_SPI_CS3);
#endif

// Set up incoming interrupts from the DW3000
uint32_t radio_interrupt_pin = PIN_RADIO_INTERRUPT;
Expand All @@ -160,6 +173,18 @@ void ranging_radio_init(uint8_t *uid)
configASSERT0(am_hal_gpio_interrupt_control(AM_HAL_GPIO_INT_CHANNEL_0, AM_HAL_GPIO_INT_CTRL_INDV_ENABLE, &radio_interrupt_pin));
NVIC_SetPriority(GPIO0_001F_IRQn + GPIO_NUM2IDX(PIN_RADIO_INTERRUPT), NVIC_configMAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_EnableIRQ(GPIO0_001F_IRQn + GPIO_NUM2IDX(PIN_RADIO_INTERRUPT));
#if REVISION_ID >= REVISION_L
radio_interrupt_pin = PIN_RADIO_INTERRUPT2;
configASSERT0(am_hal_gpio_pinconfig(PIN_RADIO_INTERRUPT2, interrupt_pin_config));
configASSERT0(am_hal_gpio_interrupt_control(AM_HAL_GPIO_INT_CHANNEL_0, AM_HAL_GPIO_INT_CTRL_INDV_ENABLE, &radio_interrupt_pin));
//NVIC_SetPriority(GPIO0_001F_IRQn + GPIO_NUM2IDX(PIN_RADIO_INTERRUPT2), NVIC_configMAX_SYSCALL_INTERRUPT_PRIORITY);
//NVIC_EnableIRQ(GPIO0_001F_IRQn + GPIO_NUM2IDX(PIN_RADIO_INTERRUPT2));
radio_interrupt_pin = PIN_RADIO_INTERRUPT3;
configASSERT0(am_hal_gpio_pinconfig(PIN_RADIO_INTERRUPT3, interrupt_pin_config));
configASSERT0(am_hal_gpio_interrupt_control(AM_HAL_GPIO_INT_CHANNEL_0, AM_HAL_GPIO_INT_CTRL_INDV_ENABLE, &radio_interrupt_pin));
//NVIC_SetPriority(GPIO0_001F_IRQn + GPIO_NUM2IDX(PIN_RADIO_INTERRUPT3), NVIC_configMAX_SYSCALL_INTERRUPT_PRIORITY);
//NVIC_EnableIRQ(GPIO0_001F_IRQn + GPIO_NUM2IDX(PIN_RADIO_INTERRUPT3));
#endif

// Initialize the SPI module and enable all relevant SPI pins
am_hal_gpio_pincfg_t sck_config = g_AM_BSP_GPIO_IOM0_SCK;
Expand Down Expand Up @@ -286,6 +311,7 @@ void ranging_radio_choose_channel(uint8_t channel)
void ranging_radio_choose_antenna(uint8_t antenna_number)
{
// Enable the desired antenna
#if REVISION_ID < REVISION_L
switch (antenna_number)
{
case 0:
Expand All @@ -303,6 +329,7 @@ void ranging_radio_choose_antenna(uint8_t antenna_number)
default:
break;
}
#endif
}

void ranging_radio_disable(void)
Expand All @@ -314,8 +341,10 @@ void ranging_radio_disable(void)
void ranging_radio_sleep(bool deep_sleep)
{
// Disable all antennas
#if REVISION_ID < REVISION_L
am_hal_gpio_output_clear(PIN_RADIO_ANTENNA_SELECT1);
am_hal_gpio_output_clear(PIN_RADIO_ANTENNA_SELECT2);
#endif

// Make sure the radio is disabled and clear the interrupt mask to disable unwanted events
dwt_forcetrxoff();
Expand Down

0 comments on commit b438772

Please sign in to comment.