Honestly, it's been a while since I did any coding, with getting the kickstarter ready, so I don't actually remember what the state of the code is right now. I think I was working on getting the UART up so we can use the GPS. I'm commiting this as more of a backup than anything.

This commit is contained in:
Michael Colton 2015-03-06 22:54:22 -07:00
parent d9c9939ab8
commit 43500cbef3
16 changed files with 9012 additions and 9178 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
Hardware/~$PSDR.sch.inf
Hardware/ElementsOnLayersReport.txt

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 KiB

Binary file not shown.

Binary file not shown.

View File

@ -206,9 +206,6 @@
<fileInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1375704298.1528905043" name="stm32f417xx.h" rcbsApplicability="disable" resourcePath="system/include/cmsis/stm32f417xx.h" toolsToInvoke=""/>
<fileInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1375704298.708018723" name="stm32f437xx.h" rcbsApplicability="disable" resourcePath="system/include/cmsis/stm32f437xx.h" toolsToInvoke=""/>
<fileInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1375704298.1431321268" name="stm32f427xx.h" rcbsApplicability="disable" resourcePath="system/include/cmsis/stm32f427xx.h" toolsToInvoke=""/>
<fileInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1375704298.1883550001" name="uart.c" rcbsApplicability="disable" resourcePath="src/uart.c" toolsToInvoke="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.98059731.1625589465">
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.98059731.1625589465" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.98059731"/>
</fileInfo>
<folderInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1375704298.608015733" name="/" resourcePath="DSP_Lib">
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.elf.debug.425450735" name="Cross ARM GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.elf.debug" unusedChildren="">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.1067485307.697494564" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.1067485307"/>

View File

@ -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-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1031763733954814818" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" 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="-1071570745985941216" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" 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>
@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1088472647586246521" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" 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="-1014861832354509513" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" 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>

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -145,6 +145,9 @@
extern const Gpio_Pin KEY1;
extern const Gpio_Pin KEY2;
// extern const Gpio_Pin NC_1;
// extern const Gpio_Pin DAC_SWITCHES;
// extern const Gpio_Pin GSM_PWRKEY;

View File

@ -50,6 +50,9 @@
#include "stm32f4xx_hal_dma.h"
#include "stm32f4xx_hal_def.h"
#include "stm32f4xx_hal_uart.h"
#include "stm32f4xx_hal_usart.h"
TIM_HandleTypeDef TimHandle;
TIM_HandleTypeDef TimHandle4;
@ -75,3 +78,4 @@ TIM_HandleTypeDef TimHandle4;
#define SPIx_DMA_RX_IRQHandler DMA2_Stream0_IRQHandler
SPI_HandleTypeDef SpiHandle;
UART_HandleTypeDef UartHandle;

View File

@ -30,6 +30,7 @@
#define __STM32F4xx_IT_H
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f4xx.h"
/* Exported types ------------------------------------------------------------*/

View File

@ -37,8 +37,7 @@
//const Gpio_Pin FINGER_PRINT_BUTTON = { GPIOB, GPIO_Pin_6 };
//const Gpio_Pin LOW_BAT = { GPIOB, GPIO_Pin_8 };
const Gpio_Pin RX_TO_GPS = { GPIOB, GPIO_PIN_6 };
const Gpio_Pin TX_FROM_GPS = { GPIOB, GPIO_PIN_7 };
@ -134,6 +133,9 @@ const Gpio_Pin GPS_RESET = { GPIOD, GPIO_PIN_1 };
const Gpio_Pin GPS_FIX_LED = { GPIOD, GPIO_PIN_3 };
const Gpio_Pin GPS_PPS = { GPIOD, GPIO_PIN_4 };
const Gpio_Pin GPS_POWER = { GPIOD, GPIO_PIN_0 };
const Gpio_Pin RX_TO_GPS = { GPIOB, GPIO_PIN_6 };
const Gpio_Pin TX_FROM_GPS = { GPIOB, GPIO_PIN_7 };
//// timer pins
//const Timer_Pin LED_G =
@ -547,12 +549,19 @@ void hal_setupPins(void)
HAL_GPIO_Init(DAC_MUX.port, &gpioInitStructure);
HAL_GPIO_WritePin(DAC_MUX.port, DAC_MUX.pin, 1); //0 = speaker/earphone. Speaker doesn't seem to work, btw...
// gpioInitStructure.Pin = EARPHONE_NOT_INSERTED.pin;
// gpioInitStructure.Mode = GPIO_MODE_ANALOG;
// gpioInitStructure.Speed = GPIO_SPEED_LOW;
// gpioInitStructure.Pull = GPIO_NOPULL;
// HAL_GPIO_Init(EARPHONE_NOT_INSERTED.port, &gpioInitStructure);
// HAL_GPIO_WritePin(EARPHONE_NOT_INSERTED.port, EARPHONE_NOT_INSERTED.pin, 0);
gpioInitStructure.Pin = EARPHONE_NOT_INSERTED.pin;
gpioInitStructure.Mode = GPIO_MODE_ANALOG;
gpioInitStructure.Mode = GPIO_MODE_OUTPUT_PP;
gpioInitStructure.Speed = GPIO_SPEED_LOW;
gpioInitStructure.Pull = GPIO_NOPULL;
HAL_GPIO_Init(EARPHONE_NOT_INSERTED.port, &gpioInitStructure);
HAL_GPIO_WritePin(EARPHONE_NOT_INSERTED.port, EARPHONE_NOT_INSERTED.pin, 0);
HAL_GPIO_WritePin(EARPHONE_NOT_INSERTED.port, EARPHONE_NOT_INSERTED.pin, 1);
gpioInitStructure.Pin = AUDIO_AMP_NSHTDWN.pin;
gpioInitStructure.Mode = GPIO_MODE_OUTPUT_PP;
@ -749,7 +758,7 @@ void hal_setupPins(void)
gpioInitStructure.Mode = GPIO_MODE_OUTPUT_PP; //I don't know if the module has ANYTHING hooked up to these pins yet.
gpioInitStructure.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPS_RESET.port, &gpioInitStructure);
HAL_GPIO_WritePin(GPS_POWER.port, GPS_POWER.pin, 0);
HAL_GPIO_WritePin(GPS_RESET.port, GPS_RESET.pin, 1);
gpioInitStructure.Pin = GPS_FIX_LED.pin;
gpioInitStructure.Speed = GPIO_SPEED_LOW;

View File

@ -656,6 +656,56 @@ void setGainPot(uint8_t a, uint8_t b)
}
USART1_IRQHandler(void)
{
//blink_led_on();
USARTx_IRQHandler();
}
GPIO_InitTypeDef GPIO_InitStruct;
__IO ITStatus UartReady = RESET;
uint8_t aTxBuffer[] = "Chris a baby! ";
uint8_t aRxBuffer[256];
void configUartPeripheral()
{
//Enable Clocks
__GPIOB_CLK_ENABLE();
__USART1_CLK_ENABLE();
//Setup TX Pin
GPIO_InitStruct.Pin = GPIO_PIN_6;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
//Setup RX Pin
//It doesn't get set as an input?
GPIO_InitStruct.Pin = GPIO_PIN_7;
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
//Configure NVIC
HAL_NVIC_SetPriority(USART1_IRQn, 0, 1);
HAL_NVIC_EnableIRQ(USART1_IRQn);
UartHandle.Instance = USART1;
UartHandle.Init.BaudRate = 9600;
UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
UartHandle.Init.StopBits = UART_STOPBITS_1;
UartHandle.Init.Parity = UART_PARITY_NONE;
UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
UartHandle.Init.Mode = UART_MODE_TX_RX;
HAL_UART_Init(&UartHandle);
}
int
main(int argc, char* argv[])
{
@ -729,6 +779,15 @@ main(int argc, char* argv[])
setGainPot(128, 128);
//testing Uart
configUartPeripheral();
// while(1)
// {
// //HAL_UART_Transmit_IT(&UartHandle, (uint8_t*)aTxBuffer, 16);
//
// hal_delay_ms(100);
// }
//MAIN LOOP - Lowest Priority
while(1)
{
@ -745,6 +804,13 @@ main(int argc, char* argv[])
//Also since this is a form of direct conversion receiver (two of them together) I was worried about AM broadcast interference
//but I haven't noticed any, again, maybe I did something right? Beginner's luck?
HAL_UART_Receive_IT(&UartHandle, (uint8_t*)aRxBuffer, 16);
int* p = UartHandle.pRxBuffPtr;
int* q = &aRxBuffer;
int difference = p- q;
updateMenu();
updateDisplay(0);
drawWaterfall();
@ -1147,7 +1213,8 @@ void processStream()
for(i = 0; i < FFT_SIZE; i++)
{
samplesA[i * 2] = samplesDemod[i];
samplesA[i * 2 + 1] = samplesDemod[i];
samplesA[i * 2 + 1] = /*1.0 -*/ samplesDemod[i]; //invert one of them so they don't cancel
//Isn't working yet...
}
}

View File

@ -185,6 +185,19 @@ void SPIx_DMA_RX_IRQHandler(void)
HAL_DMA_IRQHandler(SpiHandle.hdmarx);
}
/**
* @brief This function handles UART interrupt request.
* @param None
* @retval None
* @Note This function is redefined in "main.h" and related to DMA stream
* used for USART data transmission
*/
void USARTx_IRQHandler(void)
{
HAL_UART_IRQHandler(& UartHandle);
}
//void TIM3_IRQHandler(void)
//{
// __HAL_TIM_CLEAR_IT(htim, TIM_IT_UPDATE);

View File

@ -5,6 +5,7 @@
#include "uart.h"
#include <queue.h>
#include <hal.h>
#include <stddef.h>
#include <stm32f4xx_hal_usart.h>
@ -459,17 +460,21 @@ int uart_queueContains(char thingToFind[], int thingToFindLength, uint8_t uart)
return false;
}
USART_HandleTypeDef usart;
void USART1_IRQHandler(void)
{
// uart 1 interrupt handler
// this function name must match that in the startup file
// handle uart rx char
if( USART_GetITStatus(USART1, USART_IT_RXNE) != RESET )
//if( USART_GetITStatus(USART1, USART_IT_RXNE) != RESET )
if(HAL_USART_GetState(usart) != HAL_USART_STATE_RESET) ;
{
uint8_t data;
data = USART_ReceiveData(USART1) & 0xFF;
//data = USART_ReceiveData(USART1) & 0xFF;
//data = HAL_USART_Receive(usart, data, 1,
HAL_USART_Receive_IT(usart, data, 1);
if( queue8_enqueue(&uart1RxQ, data) )
uart1RxOverflow = true;
}