Tweaks to 1.0 firmware. Not completely working yet :(

USG_1.0
Robert Fisk 9 years ago
parent e29ef84861
commit 25ff531917

@ -23,18 +23,6 @@
#define PB_JTDO GPIO_PIN_3
#define PB_NJTRST GPIO_PIN_4
#define USB_FS_VBUS_PIN GPIO_PIN_9
#define USB_FS_VBUS_PORT GPIOA
#define USB_FS_VBUSON_PIN GPIO_PIN_10
#define USB_FS_VBUSON_PORT GPIOA
#define USB_FS_FAULT_PIN GPIO_PIN_6
#define USB_FS_FAULT_PORT GPIOB
#define USB_HS_VBUS_PIN GPIO_PIN_13
#define USB_HS_VBUS_PORT GPIOB
#define USB_HS_VBUSON_PIN GPIO_PIN_8
#define USB_HS_VBUSON_PORT GPIOA
#define FAULT_LED_PIN GPIO_PIN_13
#define FAULT_LED_PORT GPIOC
#define FAULT_LED_ON (FAULT_LED_PORT->BSRR = (FAULT_LED_PIN << BSRR_SHIFT_LOW)) //Fault LED is active-low

@ -99,7 +99,7 @@
* (when HSE is used as system clock source, directly or through the PLL).
*/
#if !defined (HSE_VALUE)
#define HSE_VALUE ((uint32_t)12000000) /*!< Value of the External oscillator in Hz */
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
#endif /* HSE_VALUE */
#if !defined (HSE_STARTUP_TIMEOUT)

@ -79,7 +79,7 @@ int main(void)
void CheckFirmwareMatchesHardware(void)
{
//Check we are running on the expected hardware:
//STM32F407 on an Olimex dev board
//STM32F401RC on USG v1.0 beta
GPIO_InitTypeDef GPIO_InitStruct;
@ -165,7 +165,6 @@ void GPIO_Init(void)
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
//Bulk initialise all ports as inputs with pullups active,
//excluding JTAG pins which must remain as AF0!
@ -180,36 +179,18 @@ void GPIO_Init(void)
GPIO_InitStruct.Pin = GPIO_PIN_All;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
//USB VBUS pins are analog input
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pin = USB_FS_VBUS_PIN;
HAL_GPIO_Init(USB_FS_VBUS_PORT, &GPIO_InitStruct);
GPIO_InitStruct.Pin = USB_HS_VBUS_PIN;
HAL_GPIO_Init(USB_HS_VBUS_PORT, &GPIO_InitStruct);
//Enable USB_FS power
USB_FS_VBUSON_PORT->BSRR = (USB_FS_VBUSON_PIN << BSRR_SHIFT_HIGH);
//Fault LED is output
GPIO_InitStruct.Pin = FAULT_LED_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Pin = USB_FS_VBUSON_PIN;
HAL_GPIO_Init(USB_FS_VBUSON_PORT, &GPIO_InitStruct);
//Disable USB_HS power
USB_HS_VBUSON_PORT->BSRR = (USB_HS_VBUSON_PIN << BSRR_SHIFT_LOW);
GPIO_InitStruct.Pin = USB_HS_VBUSON_PIN;
HAL_GPIO_Init(USB_HS_VBUSON_PORT, &GPIO_InitStruct);
//STAT_LED is output
FAULT_LED_OFF;
GPIO_InitStruct.Pin = FAULT_LED_PIN;
HAL_GPIO_Init(FAULT_LED_PORT, &GPIO_InitStruct);
FAULT_LED_OFF;
//SPI_INT_ACTIVE indicator
GPIO_InitStruct.Pin = INT_ACTIVE_PIN;
HAL_GPIO_Init(INT_ACTIVE_PORT, &GPIO_InitStruct);
INT_ACTIVE_OFF;
// //SPI_INT_ACTIVE indicator
// GPIO_InitStruct.Pin = INT_ACTIVE_PIN;
// HAL_GPIO_Init(INT_ACTIVE_PORT, &GPIO_InitStruct);
// INT_ACTIVE_OFF;
}

@ -22,9 +22,6 @@
#define PB_JTDO GPIO_PIN_3
#define PB_NJTRST GPIO_PIN_4
#define USB_P_PIN GPIO_PIN_4
#define USB_P_PORT GPIOC
#define FAULT_LED_PIN GPIO_PIN_13
#define FAULT_LED_PORT GPIOC
#define FAULT_LED_ON (FAULT_LED_PORT->BSRR = (FAULT_LED_PIN << BSRR_SHIFT_LOW)) //Fault LED is active-low

@ -74,16 +74,16 @@ void OTG_FS_IRQHandler(void)
void DMA2_Stream2_IRQHandler(void)
{
INT_ACTIVE_ON;
// INT_ACTIVE_ON;
HAL_DMA_IRQHandler(&spiRxDmaHandle);
INT_ACTIVE_OFF;
// INT_ACTIVE_OFF;
}
void DMA2_Stream3_IRQHandler(void)
{
INT_ACTIVE_ON;
// INT_ACTIVE_ON;
HAL_DMA_IRQHandler(&spiTxDmaHandle);
INT_ACTIVE_OFF;
// INT_ACTIVE_OFF;
}
void EXTI3_IRQHandler(void)

@ -84,7 +84,7 @@ int main(void)
void CheckFirmwareMatchesHardware(void)
{
//Check we are running on the expected hardware:
//STM32F405 on an Olimex dev board
//STM32F401RC on USG v1.0 beta
GPIO_InitTypeDef GPIO_InitStruct;
@ -191,24 +191,19 @@ void GPIO_Init(void)
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
//USB_P is analog input
GPIO_InitStruct.Pin = USB_P_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
HAL_GPIO_Init(USB_P_PORT, &GPIO_InitStruct);
//STAT_LED is output
//Fault LED is output
GPIO_InitStruct.Pin = FAULT_LED_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(FAULT_LED_PORT, &GPIO_InitStruct);
FAULT_LED_OFF;
//SPI_INT_ACTIVE indicator
GPIO_InitStruct.Pin = INT_ACTIVE_PIN;
//GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
//GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(INT_ACTIVE_PORT, &GPIO_InitStruct);
INT_ACTIVE_OFF;
// //SPI_INT_ACTIVE indicator
// GPIO_InitStruct.Pin = INT_ACTIVE_PIN;
// //GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
// //GPIO_InitStruct.Pull = GPIO_NOPULL;
// HAL_GPIO_Init(INT_ACTIVE_PORT, &GPIO_InitStruct);
// INT_ACTIVE_OFF;
}
/* USER CODE BEGIN 4 */

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="ilg.gnuarmeclipse.debug.gdbjtag.openocd.launchConfigurationType">
<stringAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.PERIPHERALS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;peripherals/&gt;&#10;"/>
<stringAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.PERIPHERALS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;peripherals&gt;&#10;&lt;peripheral name=&quot;DMA2&quot;/&gt;&#10;&lt;/peripherals&gt;&#10;"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doContinue" value="true"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doDebugInRam" value="false"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doFirstReset" value="true"/>

Loading…
Cancel
Save