Skip to content

Commit

Permalink
Fixed dfu release generation and touchscreen sensitivity.
Browse files Browse the repository at this point in the history
  • Loading branch information
AA6KL committed Feb 3, 2020
1 parent 2509e6d commit c21ec25
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
20 changes: 10 additions & 10 deletions adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static adcsample_t samplesVBAT[ADC_GRP_NUM_CHANNELS_VBAT*ADC_GRP_BUF_DEPTH_VBAT]
static adcsample_t samples[2];

static const ADCConversionGroup adcgrpcfgVBAT = {
FALSE,
FALSE,
ADC_GRP_NUM_CHANNELS_VBAT,
NULL,
NULL,
Expand All @@ -49,9 +49,13 @@ static const ADCConversionGroup adcgrpcfgVBAT = {

adcerrorcallback_t adcerrorcallback(ADCDriver *adcp, adcerror_t err);

#define ADC_GRP_NUM_CHANNELS_TOUCH 1
#define ADC_GRP_BUF_DEPTH_TOUCH 1
static adcsample_t samplesTouch[ADC_GRP_NUM_CHANNELS_TOUCH*ADC_GRP_BUF_DEPTH_TOUCH];

static ADCConversionGroup adcgrpcfgTouch = {
FALSE,
1,
TRUE,
ADC_GRP_NUM_CHANNELS_TOUCH,
NULL, /* adccallback_touch */
adcerrorcallback, /* adcerrorcallback_touch */
/* CFGR */
Expand Down Expand Up @@ -220,12 +224,8 @@ void adc_start_analog_watchdogd(ADC_TypeDef *adc, uint32_t chsel)
#ifdef NANOVNA_F303
adcStart(&ADCD2, NULL);
adcgrpcfgTouch.sqr[0] = ADC_SQR1_SQ1_N(chsel);
adcConvert(&ADCD2, &adcgrpcfgTouch, samples, 1);
chThdSleepMilliseconds(100);
ADC2->ISR = ADC_ISR_ADRDY;
ADC2->IER = (ADC_IER_AWD1IE | ADC_IER_EOSMPIE);
ADC2->CFGR &= ~ADC_CFGR_DMAEN;
ADC2->CR |= ADC_CR_ADSTART;
ADC2->CFGR &= ~ADC_CFGR_DMAEN; // No need to do DMA
adcStartConversion(&ADCD2, &adcgrpcfgTouch, samplesTouch, ADC_GRP_BUF_DEPTH_TOUCH);
#else
cfgr1 = ADC_CFGR1_RES_12BIT | ADC_CFGR1_AWDEN
| ADC_CFGR1_EXTEN_0 // rising edge of external trigger
Expand All @@ -251,7 +251,7 @@ void adc_stop(ADC_TypeDef *adc)
{
#ifdef NANOVNA_F303
#if 1
adcStop(&ADCD2);
adcStopConversion(&ADCD2);
#else
if (ADC2->CR & ADC_CR_ADEN) {
if (ADC2->CR & ADC_CR_ADSTART) {
Expand Down
7 changes: 6 additions & 1 deletion gen_dfu.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/sh
cp build/ch.bin release/NanoVNA-H4_$(date +"%Y%m%d").bin
cp build/ch.hex release/NanoVNA-H4_$(date +"%Y%m%d").hex
dfu-tool convert raw build/ch.bin release/NanoVNA-H4_$(date +"%Y%m%d").dfu
dfu-tool convert dfuse build/ch.bin release/NanoVNA-H4_$(date +"%Y%m%d").dfu
dfu-tool set-vendor release/NanoVNA-H4_$(date +"%Y%m%d").dfu 0483
dfu-tool set-release release/NanoVNA-H4_$(date +"%Y%m%d").dfu 0000
#dfu-tool set-product release/NanoVNA-H4_$(date +"%Y%m%d").dfu 0000
dfu-tool set-address release/NanoVNA-H4_$(date +"%Y%m%d").dfu 0x8000000
dfu-tool set-alt-setting-name release/NanoVNA-H4_$(date +"%Y%m%d").dfu NanoVNA-H4

7 changes: 5 additions & 2 deletions my_note.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
~/Downloads/ChibiStudio_Linux_Preview2/ChibiStudio/ChibiStudio-GCC7.3.1 &

#Launch STM32CubeMX
cd /usr/local/STMicroelectronics/STM32Cube/STM32CubeMX
./STM32CubeMX &
#cd /usr/local/STMicroelectronics/STM32Cube/STM32CubeMX
#./STM32CubeMX &
/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/STM32CubeMX &

# How to use ChibiSTudio
Expand All @@ -36,6 +36,9 @@ Special ADC channels
- VREFOPAMP3 connected to ADC3 channel 17
- VREFOPAMP4 connected to ADC4 channel 17

ADC Analog Watchdog reference:
http://www.chibios.com/forum/viewtopic.php?t=3959

~/Downloads/ChibiOS_18.2.2/testhal/STM32/STM32F3xx/ADC

STM32BubeMX:
Expand Down

0 comments on commit c21ec25

Please sign in to comment.