Just backing up. PSDR2 is receiving well, image rejection is good. Gain pot settings work. Audio out works (to earphones only, the speaker fails pretty badly, not sure why, but that's hardware anyway)

This commit is contained in:
Michael Colton 2014-10-01 10:48:27 -06:00
parent 817dcff56e
commit 7f0b21569c
10 changed files with 8133 additions and 15 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,5 @@
#MicroXplorer Configuration settings - do not modify #MicroXplorer Configuration settings - do not modify
#Sat Sep 27 00:43:07 MDT 2014 #Mon Sep 29 11:29:24 MDT 2014
ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_TEMPSENSOR ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_TEMPSENSOR
ADC1.IPParameters=NbrOfConversionFlag,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,Rank-0\#ChannelRegularConversion,master ADC1.IPParameters=NbrOfConversionFlag,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,Rank-0\#ChannelRegularConversion,master
ADC1.NbrOfConversionFlag=1 ADC1.NbrOfConversionFlag=1
@ -263,11 +263,11 @@ ProjectManager.FreePins=false
ProjectManager.HalAssertFull=false ProjectManager.HalAssertFull=false
ProjectManager.KeepUserCode=true ProjectManager.KeepUserCode=true
ProjectManager.LastFirmware=true ProjectManager.LastFirmware=true
ProjectManager.LibraryCopy=0 ProjectManager.LibraryCopy=1
ProjectManager.ProjectBuild=false ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=PSDR.ioc ProjectManager.ProjectFileName=PSDR.ioc
ProjectManager.ProjectName=PSDR ProjectManager.ProjectName=PSDR
ProjectManager.TargetToolchain=EWARM 6.70 ProjectManager.TargetToolchain=MDK-ARM 4.73
RCC.APB1CLKDivider=RCC_HCLK_DIV4 RCC.APB1CLKDivider=RCC_HCLK_DIV4
RCC.APB2CLKDivider=RCC_HCLK_DIV2 RCC.APB2CLKDivider=RCC_HCLK_DIV2
RCC.FamilyName=M RCC.FamilyName=M

Binary file not shown.

BIN
Source/Debug/PSDR.elf Normal file

Binary file not shown.

8095
Source/Debug/PSDR.hex Normal file

File diff suppressed because it is too large Load diff

View file

@ -106,6 +106,7 @@
extern const Gpio_Pin DDS_FSEL; extern const Gpio_Pin DDS_FSEL;
extern const Gpio_Pin DDS_PSEL; extern const Gpio_Pin DDS_PSEL;
extern const Gpio_Pin RX_MUX; extern const Gpio_Pin RX_MUX;
extern const Gpio_Pin TX_MUX;
extern const Gpio_Pin AMP_SWITCH_A; extern const Gpio_Pin AMP_SWITCH_A;
extern const Gpio_Pin AMP_SWITCH_B; extern const Gpio_Pin AMP_SWITCH_B;
extern const Gpio_Pin IMP_BRIDGE_SWITCH_A; extern const Gpio_Pin IMP_BRIDGE_SWITCH_A;
@ -119,6 +120,8 @@
extern const Gpio_Pin GAIN_POT_MOSI; extern const Gpio_Pin GAIN_POT_MOSI;
extern const Gpio_Pin GAIN_POT_NSS; extern const Gpio_Pin GAIN_POT_NSS;
extern const Gpio_Pin IN_AMP_ENABLE;
extern const Gpio_Pin DAC_MUX;

View file

@ -83,6 +83,7 @@ const Gpio_Pin REF_CLOCK_DISABLE = { GPIOC, GPIO_PIN_2 };
const Gpio_Pin DDS_FSEL = { GPIOA, GPIO_PIN_1 }; const Gpio_Pin DDS_FSEL = { GPIOA, GPIO_PIN_1 };
const Gpio_Pin DDS_PSEL = { GPIOA, GPIO_PIN_2 }; const Gpio_Pin DDS_PSEL = { GPIOA, GPIO_PIN_2 };
const Gpio_Pin RX_MUX = { GPIOB, GPIO_PIN_15 }; const Gpio_Pin RX_MUX = { GPIOB, GPIO_PIN_15 };
const Gpio_Pin TX_MUX = { GPIOB, GPIO_PIN_14 };
const Gpio_Pin AMP_SWITCH_A = { GPIOE, GPIO_PIN_8 }; const Gpio_Pin AMP_SWITCH_A = { GPIOE, GPIO_PIN_8 };
const Gpio_Pin AMP_SWITCH_B = { GPIOE, GPIO_PIN_9 }; const Gpio_Pin AMP_SWITCH_B = { GPIOE, GPIO_PIN_9 };
const Gpio_Pin IMP_BRIDGE_SWITCH_A = { GPIOE, GPIO_PIN_11 }; const Gpio_Pin IMP_BRIDGE_SWITCH_A = { GPIOE, GPIO_PIN_11 };
@ -96,6 +97,10 @@ const Gpio_Pin GAIN_POT_SCLK = { GPIOB , GPIO_PIN_11 };
const Gpio_Pin GAIN_POT_MOSI = { GPIOE , GPIO_PIN_15}; const Gpio_Pin GAIN_POT_MOSI = { GPIOE , GPIO_PIN_15};
const Gpio_Pin GAIN_POT_NSS = { GPIOB , GPIO_PIN_10}; const Gpio_Pin GAIN_POT_NSS = { GPIOB , GPIO_PIN_10};
const Gpio_Pin DAC_MUX = { GPIOD, GPIO_PIN_8 };
//const Gpio_Pin IN_AMP_ENABLE = { GPIO, GPIO_PIN_ }; //FORGOT TO CONNECT IT TO THE MCU!
//const Gpio_Pin NC_1 = { GPIOC, GPIO_Pin_0 }; // this is the Closure Sensor Pin near the 3v3 regulator, fyi //const Gpio_Pin NC_1 = { GPIOC, GPIO_Pin_0 }; // this is the Closure Sensor Pin near the 3v3 regulator, fyi
//const Gpio_Pin DAC_SWITCHES = { GPIOC, GPIO_Pin_5 }; // currently labeled LIGHT_SENSOR on schem (TODO) //const Gpio_Pin DAC_SWITCHES = { GPIOC, GPIO_Pin_5 }; // currently labeled LIGHT_SENSOR on schem (TODO)
//const Gpio_Pin GSM_PWRKEY = { GPIOC, GPIO_Pin_8 }; //const Gpio_Pin GSM_PWRKEY = { GPIOC, GPIO_Pin_8 };
@ -415,14 +420,21 @@ void hal_setupPins(void)
gpioInitStructure.Speed = GPIO_SPEED_LOW; gpioInitStructure.Speed = GPIO_SPEED_LOW;
gpioInitStructure.Pull = GPIO_NOPULL; gpioInitStructure.Pull = GPIO_NOPULL;
HAL_GPIO_Init(RX_MUX.port, &gpioInitStructure); HAL_GPIO_Init(RX_MUX.port, &gpioInitStructure);
HAL_GPIO_WritePin(RX_MUX.port, RX_MUX.pin, 1); HAL_GPIO_WritePin(RX_MUX.port, RX_MUX.pin, 0); //Active Low
gpioInitStructure.Pin = TX_MUX.pin;
gpioInitStructure.Mode = GPIO_MODE_OUTPUT_PP;
gpioInitStructure.Speed = GPIO_SPEED_LOW;
gpioInitStructure.Pull = GPIO_NOPULL;
HAL_GPIO_Init(TX_MUX.port, &gpioInitStructure);
HAL_GPIO_WritePin(TX_MUX.port, TX_MUX.pin, 1); //Active Low
gpioInitStructure.Pin = TX_RF_SWITCH_A.pin; gpioInitStructure.Pin = TX_RF_SWITCH_A.pin;
gpioInitStructure.Mode = GPIO_MODE_OUTPUT_PP; gpioInitStructure.Mode = GPIO_MODE_OUTPUT_PP;
gpioInitStructure.Speed = GPIO_SPEED_LOW; gpioInitStructure.Speed = GPIO_SPEED_LOW;
gpioInitStructure.Pull = GPIO_NOPULL; gpioInitStructure.Pull = GPIO_NOPULL;
HAL_GPIO_Init(TX_RF_SWITCH_A.port, &gpioInitStructure); HAL_GPIO_Init(TX_RF_SWITCH_A.port, &gpioInitStructure);
HAL_GPIO_WritePin(TX_RF_SWITCH_A.port, TX_RF_SWITCH_A.pin, 0); //0 to route to TX SMA connector HAL_GPIO_WritePin(TX_RF_SWITCH_A.port, TX_RF_SWITCH_A.pin, 0); //0 to route to TX SMA connector... I think
gpioInitStructure.Pin = TX_RF_SWITCH_B.pin; gpioInitStructure.Pin = TX_RF_SWITCH_B.pin;
gpioInitStructure.Mode = GPIO_MODE_OUTPUT_PP; gpioInitStructure.Mode = GPIO_MODE_OUTPUT_PP;
@ -452,7 +464,12 @@ void hal_setupPins(void)
HAL_GPIO_Init(GAIN_POT_NSS.port, &gpioInitStructure); HAL_GPIO_Init(GAIN_POT_NSS.port, &gpioInitStructure);
HAL_GPIO_WritePin(GAIN_POT_NSS.port, GAIN_POT_NSS.pin, 1); HAL_GPIO_WritePin(GAIN_POT_NSS.port, GAIN_POT_NSS.pin, 1);
gpioInitStructure.Pin = DAC_MUX.pin;
gpioInitStructure.Mode = GPIO_MODE_OUTPUT_PP;
gpioInitStructure.Speed = GPIO_SPEED_LOW;
gpioInitStructure.Pull = GPIO_NOPULL;
HAL_GPIO_Init(DAC_MUX.port, &gpioInitStructure);
HAL_GPIO_WritePin(DAC_MUX.port, DAC_MUX.pin, 0); //0 = speaker/earphone. Speaker doesn't seem to work, btw...
// Power Switch // Power Switch
// gpioInitStructure.GPIO_Pin = POWER_SWITCH.pin; // gpioInitStructure.GPIO_Pin = POWER_SWITCH.pin;

View file

@ -69,7 +69,7 @@ uint16_t menuLastPos = 1;
uint16_t menuCount = 11; uint16_t menuCount = 11;
uint32_t frequencyDialMultiplier = 1; uint32_t frequencyDialMultiplier = 1;
long vfoAFrequency = 7236400; long vfoAFrequency = 6111000;
long vfoALastFreq = 0; long vfoALastFreq = 0;
int encoderPos, encoderLastPos; int encoderPos, encoderLastPos;
@ -368,7 +368,8 @@ int isFwd;
//int sampleCounter = 0; //int sampleCounter = 0;
//const int FFT_SIZE = 256; //const int FFT_SIZE = 256;
float observerA, observerB, observerC; float observerA, observerB, observerC;
int dcOffset = 1533; int dcOffset1 = 1539;
int dcOffset2 = 1530;
void captureSamples() void captureSamples()
{ {
@ -381,8 +382,8 @@ int isFwd;
{ {
case 0: case 0:
samplesA[sampleIndex*2] = ((uhADCxConvertedValue - dcOffset)/4096.0); // - 2048; samplesA[sampleIndex*2] = ((uhADCxConvertedValue - dcOffset1)/4096.0); // - 2048;
samplesA[sampleIndex*2 + 1] = ((uhADCxConvertedValue2 - dcOffset)/4096.0); // - 2048;//0.0; samplesA[sampleIndex*2 + 1] = ((uhADCxConvertedValue2 - dcOffset2)/4096.0); // - 2048;//0.0;
if(uhADCxConvertedValue > maxAmplitude) maxAmplitude = uhADCxConvertedValue; if(uhADCxConvertedValue > maxAmplitude) maxAmplitude = uhADCxConvertedValue;
if(uhADCxConvertedValue2 > maxAmplitude) maxAmplitude = uhADCxConvertedValue2; if(uhADCxConvertedValue2 > maxAmplitude) maxAmplitude = uhADCxConvertedValue2;
@ -410,8 +411,8 @@ int isFwd;
case 1: case 1:
samplesB[sampleIndex*2] = ((uhADCxConvertedValue - dcOffset)/4096.0); // - 2048; samplesB[sampleIndex*2] = ((uhADCxConvertedValue - dcOffset1)/4096.0); // - 2048;
samplesB[sampleIndex*2 + 1] = ((uhADCxConvertedValue2 - dcOffset)/4096.0); // - 2048;//0.0; samplesB[sampleIndex*2 + 1] = ((uhADCxConvertedValue2 - dcOffset2)/4096.0); // - 2048;//0.0;
if(uhADCxConvertedValue > maxAmplitude) maxAmplitude = uhADCxConvertedValue; if(uhADCxConvertedValue > maxAmplitude) maxAmplitude = uhADCxConvertedValue;
if(uhADCxConvertedValue2 > maxAmplitude) maxAmplitude = uhADCxConvertedValue2; if(uhADCxConvertedValue2 > maxAmplitude) maxAmplitude = uhADCxConvertedValue2;
@ -439,8 +440,8 @@ int isFwd;
case 2: case 2:
samplesC[sampleIndex*2] = ((uhADCxConvertedValue - dcOffset)/4096.0); // - 2048; samplesC[sampleIndex*2] = ((uhADCxConvertedValue - dcOffset1)/4096.0); // - 2048;
samplesC[sampleIndex*2 + 1] = ((uhADCxConvertedValue2 - dcOffset)/4096.0); // - 2048;//0.0; samplesC[sampleIndex*2 + 1] = ((uhADCxConvertedValue2 - dcOffset2)/4096.0); // - 2048;//0.0;
if(uhADCxConvertedValue > maxAmplitude) maxAmplitude = uhADCxConvertedValue; if(uhADCxConvertedValue > maxAmplitude) maxAmplitude = uhADCxConvertedValue;
if(uhADCxConvertedValue2 > maxAmplitude) maxAmplitude = uhADCxConvertedValue2; if(uhADCxConvertedValue2 > maxAmplitude) maxAmplitude = uhADCxConvertedValue2;
@ -521,6 +522,8 @@ void zeroSampleBank(float *samples)
for(; i < FFT_BUFFER_SIZE; i++) samples[i] = 0; for(; i < FFT_BUFFER_SIZE; i++) samples[i] = 0;
} }
//Seems to be working, higher numbers are higher gain. I'll need to work out the math on how much.
void setGainPot(uint8_t a, uint8_t b) void setGainPot(uint8_t a, uint8_t b)
{ {
uint8_t i; uint8_t i;
@ -544,7 +547,7 @@ void setGainPot(uint8_t a, uint8_t b)
HAL_GPIO_WritePin(GAIN_POT_NSS.port, GAIN_POT_NSS.pin, 0); HAL_GPIO_WritePin(GAIN_POT_NSS.port, GAIN_POT_NSS.pin, 0);
//choose first register //choose second register
HAL_GPIO_WritePin(GAIN_POT_MOSI.port, GAIN_POT_MOSI.pin, 1); HAL_GPIO_WritePin(GAIN_POT_MOSI.port, GAIN_POT_MOSI.pin, 1);
HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 0); HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 0);
HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 1); HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 1);