From 352471857fc2b54693e5be2df529a0f654abc4d1 Mon Sep 17 00:00:00 2001 From: Brian Webb Date: Sun, 6 May 2012 15:07:07 -0700 Subject: [PATCH] Reverted USB configuration and switched all non-blocking COM calls to blocking, which appears to help prevent lockups now that all sends are in a different thread. --- .../Modules/RadioComBridge/RadioComBridge.c | 6 ++--- .../board_hw_defs/pipxtreme/board_hw_defs.c | 24 ++++++++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/flight/Modules/RadioComBridge/RadioComBridge.c b/flight/Modules/RadioComBridge/RadioComBridge.c index 7d2c387ad..c55685f54 100644 --- a/flight/Modules/RadioComBridge/RadioComBridge.c +++ b/flight/Modules/RadioComBridge/RadioComBridge.c @@ -43,8 +43,6 @@ #include -//#undef PIOS_INCLUDE_USB - // **************** // Private constants @@ -635,7 +633,7 @@ static int32_t transmitData(uint8_t *buf, int32_t length) */ static int32_t transmitPacket(PHPacketHandle p) { - return PIOS_COM_SendBufferNonBlocking(data->radio_port, (uint8_t*)p, PH_PACKET_SIZE(p)); + return PIOS_COM_SendBuffer(data->radio_port, (uint8_t*)p, PH_PACKET_SIZE(p)); } /** @@ -653,7 +651,7 @@ static void receiveData(uint8_t *buf, uint8_t len) #endif /* PIOS_INCLUDE_USB */ // Send the received data to the com port - if (PIOS_COM_SendBufferNonBlocking(outputPort, buf, len) != len) + if (PIOS_COM_SendBuffer(outputPort, buf, len) != len) // Error on transmit data->comTxErrors++; } diff --git a/flight/board_hw_defs/pipxtreme/board_hw_defs.c b/flight/board_hw_defs/pipxtreme/board_hw_defs.c index de4d817eb..7b5557d49 100644 --- a/flight/board_hw_defs/pipxtreme/board_hw_defs.c +++ b/flight/board_hw_defs/pipxtreme/board_hw_defs.c @@ -429,14 +429,22 @@ static const struct pios_tim_clock_cfg tim_4_cfg = { #include "pios_usb_priv.h" static const struct pios_usb_cfg pios_usb_main_cfg = { - .irq = { - .init = { - .NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn, - .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW, - .NVIC_IRQChannelSubPriority = 0, - .NVIC_IRQChannelCmd = ENABLE, - }, - }, + .irq = { + .init = { + .NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW, + .NVIC_IRQChannelSubPriority = 0, + .NVIC_IRQChannelCmd = ENABLE, + }, + }, + .vsense = { + .gpio = GPIOA, + .init = { + .GPIO_Pin = GPIO_Pin_8, + .GPIO_Speed = GPIO_Speed_10MHz, + .GPIO_Mode = GPIO_Mode_AF_OD, + }, + } }; #include "pios_usb_board_data_priv.h"