Skip to content

Commit

Permalink
Correction of pin for the LPS deck. #368
Browse files Browse the repository at this point in the history
There was a mixup of pin definitions which caused the wrong pin to be read. This in turn caused the interrupt handling task to exit the handling function, when the status register was updated during handing.
  • Loading branch information
krichardsson committed Aug 18, 2020
1 parent dd3a893 commit c68d7bc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/deck/drivers/src/locodeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@

// LOCO deck alternative IRQ and RESET pins(IO_2, IO_3) instead of default (RX1, TX1), leaving UART1 free for use
#ifdef LOCODECK_USE_ALT_PINS
#define GPIO_PIN_IRQ GPIO_Pin_5
#define GPIO_PIN_RESET GPIO_Pin_4
#define GPIO_PORT GPIOB
#define GPIO_PIN_IRQ DECK_GPIO_IO2
#define EXTI_PortSource EXTI_PortSourceGPIOB
#define EXTI_PinSource EXTI_PinSource5
#define EXTI_LineN EXTI_Line5
#define EXTI_IRQChannel EXTI9_5_IRQn
#else
#define GPIO_PIN_IRQ GPIO_Pin_11
#define GPIO_PIN_RESET GPIO_Pin_10
#define GPIO_PORT GPIOC
#define GPIO_PIN_IRQ DECK_GPIO_RX1
#define EXTI_PortSource EXTI_PortSourceGPIOC
#define EXTI_PinSource EXTI_PinSource11
#define EXTI_LineN EXTI_Line11
Expand Down Expand Up @@ -391,13 +391,7 @@ static void dwm1000Init(DeckInfo *info)

spiBegin();

// Init IRQ input
bzero(&GPIO_InitStructure, sizeof(GPIO_InitStructure));
GPIO_InitStructure.GPIO_Pin = GPIO_PIN_IRQ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
//GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(GPIO_PORT, &GPIO_InitStructure);

// Set up interrupt
SYSCFG_EXTILineConfig(EXTI_PortSource, EXTI_PinSource);

EXTI_InitStructure.EXTI_Line = EXTI_LineN;
Expand All @@ -413,8 +407,9 @@ static void dwm1000Init(DeckInfo *info)
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIO_PORT, &GPIO_InitStructure);

// Init CS pin
// Init pins
pinMode(CS_PIN, OUTPUT);
pinMode(GPIO_PIN_IRQ, INPUT);

// Reset the DW1000 chip
GPIO_WriteBit(GPIO_PORT, GPIO_PIN_RESET, 0);
Expand Down

0 comments on commit c68d7bc

Please sign in to comment.