Objectif 4 En cours
This commit is contained in:
parent
3dfd8436df
commit
6673d313e2
10 changed files with 338 additions and 14 deletions
Binary file not shown.
Binary file not shown.
BIN
GFSSP72/GFSSP72.pdf
Normal file
BIN
GFSSP72/GFSSP72.pdf
Normal file
Binary file not shown.
BIN
GFSSP72/gfssp72.lib
Normal file
BIN
GFSSP72/gfssp72.lib
Normal file
Binary file not shown.
|
@ -153,7 +153,40 @@
|
|||
<Name>-U066CFF574857847167074929 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>12</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134221212</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>.\Src\calcul_dft.s</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\CHTI\Src/calcul_dft.s\12</Expression>
|
||||
</Bp>
|
||||
<Bp>
|
||||
<Number>1</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>19</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134221156</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>.\Src\gestionSon.s</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\CHTI\Src/gestionSon.s\19</Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
|
@ -180,7 +213,7 @@
|
|||
<Mm>
|
||||
<WinNumber>1</WinNumber>
|
||||
<SubType>10</SubType>
|
||||
<ItemText>0x08001F24</ItemText>
|
||||
<ItemText>0x0A490BB4</ItemText>
|
||||
<AccSizeX>0</AccSizeX>
|
||||
</Mm>
|
||||
</MemoryWindow1>
|
||||
|
@ -273,6 +306,18 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\Src\calcul_dft.s</PathWithFileName>
|
||||
<FilenameWithoutPath>calcul_dft.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
|
@ -283,7 +328,7 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -303,7 +348,7 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -315,7 +360,7 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -327,13 +372,25 @@
|
|||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>4</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\GASSP72\gassp72.lib</PathWithFileName>
|
||||
<FilenameWithoutPath>gassp72.lib</FilenameWithoutPath>
|
||||
<PathWithFileName>.\GFSSP72\gfssp72.lib</PathWithFileName>
|
||||
<FilenameWithoutPath>gfssp72.lib</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\Src\tab_cos_sin.asm</PathWithFileName>
|
||||
<FilenameWithoutPath>tab_cos_sin.asm</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
|
|
|
@ -338,7 +338,7 @@
|
|||
<MiscControls>--C99</MiscControls>
|
||||
<Define>STM32F103xB,USE_FULL_LL_DRIVER</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>./GASSP72</IncludePath>
|
||||
<IncludePath>./GFSSP72</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
|
@ -392,6 +392,11 @@
|
|||
<FileType>2</FileType>
|
||||
<FilePath>.\Src\gestionSon.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>calcul_dft.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>.\Src\calcul_dft.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@ -418,9 +423,14 @@
|
|||
<FilePath>.\Src\son.asm</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>gassp72.lib</FileName>
|
||||
<FileName>gfssp72.lib</FileName>
|
||||
<FileType>4</FileType>
|
||||
<FilePath>.\GASSP72\gassp72.lib</FilePath>
|
||||
<FilePath>.\GFSSP72\gfssp72.lib</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tab_cos_sin.asm</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>.\Src\tab_cos_sin.asm</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
|
|
64
Src/calcul_dft.s
Normal file
64
Src/calcul_dft.s
Normal file
|
@ -0,0 +1,64 @@
|
|||
;ce programme est pour l'assembleur RealView (Keil)
|
||||
thumb
|
||||
area moncode, code, readonly
|
||||
export calcul_dft
|
||||
import TabCos
|
||||
import TabSin
|
||||
|
||||
;
|
||||
|
||||
|
||||
calcul_dft proc
|
||||
push {lr}
|
||||
|
||||
push {r0,r1,r4,r5}
|
||||
|
||||
ldr r2, =TabCos
|
||||
bl calcul_partie_dft ;recuperation Re(k) dans r0
|
||||
|
||||
smull r4, r5, r0, r0 ;Re(k)² dans r4, r5
|
||||
pop {r0,r1} ;recupereration de TabSig et k dans r0,r1
|
||||
|
||||
|
||||
ldr r2, =TabSin
|
||||
bl calcul_partie_dft ;mise de -Im(k) dans r0
|
||||
|
||||
smlal r4, r5, r0, r0 ;Re²+(-Im(k))²
|
||||
|
||||
mov r0, r5 ;recuperation des bits de poids fort de M2(k)
|
||||
pop {lr, r4,r5}
|
||||
bx lr
|
||||
endp
|
||||
|
||||
calcul_partie_dft proc
|
||||
push {r4-r7}
|
||||
|
||||
|
||||
mov r4, r0 ;chargement de TabSig dans r4
|
||||
mov r5, r2 ;chargement de TabCos/TabSin dans r5
|
||||
mov r6, r1 ;chargement de k dans r6
|
||||
mov r7, #0 ;ik dans r7
|
||||
|
||||
mov r3, #0 ;i=0 dans r3
|
||||
mov r0, #0 ;resultat de la somme dans r0
|
||||
|
||||
boucle ldrh r1, [r4, r3, LSL #1] ;chargement de x(i)
|
||||
ldrsh r2, [r5, r7, LSL #1] ;chargement de cos(ik..), ldrs(!)h tres important, ne fonctionne pas sinon
|
||||
|
||||
mla r0, r1, r2, r0 ;multiplication + ajout au resultat de x(i)cos(ik..)
|
||||
|
||||
add r7, r7, r6 ;mise a jour de ik
|
||||
and r7, r7, #63 ;modulo de ik par 64
|
||||
|
||||
add r3, #1 ;incrementation de i
|
||||
cmp r3, #64 ;test de i
|
||||
bne boucle
|
||||
beq sortie
|
||||
|
||||
sortie
|
||||
|
||||
pop {r4-r7}
|
||||
bx lr
|
||||
endp
|
||||
|
||||
end
|
|
@ -4,18 +4,58 @@
|
|||
#include <stdio.h>
|
||||
#include "etat.h"
|
||||
|
||||
|
||||
#define TAILLE 6
|
||||
#define periode_tick_pwm 360 // (360000 ticks équivaut à 5ms)
|
||||
#define SYSTICK_PER 360000 // (360000 ticks équivaut à 5ms)
|
||||
#define M2TIR 985988
|
||||
|
||||
|
||||
extern void timer_callback(void);
|
||||
extern short Son[];
|
||||
extern void timer_callback(void);
|
||||
extern int LongueurSon;
|
||||
extern int PeriodeSonMicroSec;
|
||||
|
||||
|
||||
extern short TabSig[];
|
||||
|
||||
extern int calcul_carre(int);
|
||||
extern int calcul_dft(unsigned short *, int);
|
||||
|
||||
int res_dft = 0;
|
||||
unsigned short dma_buf[64];
|
||||
int compteurs[TAILLE];
|
||||
int scores[TAILLE];
|
||||
int k_values[] = {17,18,19,20,23,24};
|
||||
|
||||
type_etat etat;
|
||||
|
||||
|
||||
void checkCounter(void){
|
||||
for(int i=0; i<TAILLE; i++) {
|
||||
if(compteurs[i] >= 13){
|
||||
compteurs[i]=0;
|
||||
scores[i]++;
|
||||
etat.position = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sys_callback(void){
|
||||
// Démarrage DMA pour 64 points
|
||||
Start_DMA1(64);
|
||||
Wait_On_End_Of_DMA1();
|
||||
Stop_DMA1;
|
||||
|
||||
for(int i=0; i<TAILLE; i++){
|
||||
res_dft = calcul_dft(dma_buf, k_values[i]);
|
||||
if(res_dft > M2TIR){
|
||||
compteurs[i]++;
|
||||
}else{
|
||||
compteurs[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
checkCounter();
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
@ -44,6 +84,23 @@ int main(void)
|
|||
// lancement du timer
|
||||
Run_Timer( TIM4 );
|
||||
|
||||
|
||||
// activation ADC, sampling time 1us
|
||||
Init_TimingADC_ActiveADC_ff( ADC1, 0x33 );
|
||||
Single_Channel_ADC( ADC1, 2 );
|
||||
// Déclenchement ADC par timer2, periode (72MHz/320kHz)ticks
|
||||
Init_Conversion_On_Trig_Timer_ff( ADC1, TIM2_CC2, 225 );
|
||||
// Config DMA pour utilisation du buffer dma_buf (a créér)
|
||||
Init_ADC1_DMA1( 0, dma_buf );
|
||||
|
||||
// Config Timer, période exprimée en périodes horloge CPU (72 MHz)
|
||||
Systick_Period_ff( SYSTICK_PER );
|
||||
// enregistrement de la fonction de traitement de l'interruption timer
|
||||
// ici le 3 est la priorité, sys_callback est l'adresse de cette fonction, a créér en C
|
||||
Systick_Prio_IT( 3, sys_callback );
|
||||
SysTick_On;
|
||||
SysTick_Enable_IT;
|
||||
|
||||
while(1){
|
||||
}
|
||||
|
||||
|
|
136
Src/tab_cos_sin.asm
Normal file
136
Src/tab_cos_sin.asm
Normal file
|
@ -0,0 +1,136 @@
|
|||
AREA Trigo, DATA, READONLY
|
||||
export TabSin
|
||||
export TabCos
|
||||
|
||||
TabCos
|
||||
DCW 32767 ; 0 0x7fff 0.99997
|
||||
DCW 32610 ; 1 0x7f62 0.99518
|
||||
DCW 32138 ; 2 0x7d8a 0.98077
|
||||
DCW 31357 ; 3 0x7a7d 0.95694
|
||||
DCW 30274 ; 4 0x7642 0.92389
|
||||
DCW 28899 ; 5 0x70e3 0.88193
|
||||
DCW 27246 ; 6 0x6a6e 0.83148
|
||||
DCW 25330 ; 7 0x62f2 0.77301
|
||||
DCW 23170 ; 8 0x5a82 0.70709
|
||||
DCW 20788 ; 9 0x5134 0.63440
|
||||
DCW 18205 ; 10 0x471d 0.55557
|
||||
DCW 15447 ; 11 0x3c57 0.47141
|
||||
DCW 12540 ; 12 0x30fc 0.38269
|
||||
DCW 9512 ; 13 0x2528 0.29028
|
||||
DCW 6393 ; 14 0x18f9 0.19510
|
||||
DCW 3212 ; 15 0x0c8c 0.09802
|
||||
DCW 0 ; 16 0x0000 0.00000
|
||||
DCW -3212 ; 17 0xf374 -0.09802
|
||||
DCW -6393 ; 18 0xe707 -0.19510
|
||||
DCW -9512 ; 19 0xdad8 -0.29028
|
||||
DCW -12540 ; 20 0xcf04 -0.38269
|
||||
DCW -15447 ; 21 0xc3a9 -0.47141
|
||||
DCW -18205 ; 22 0xb8e3 -0.55557
|
||||
DCW -20788 ; 23 0xaecc -0.63440
|
||||
DCW -23170 ; 24 0xa57e -0.70709
|
||||
DCW -25330 ; 25 0x9d0e -0.77301
|
||||
DCW -27246 ; 26 0x9592 -0.83148
|
||||
DCW -28899 ; 27 0x8f1d -0.88193
|
||||
DCW -30274 ; 28 0x89be -0.92389
|
||||
DCW -31357 ; 29 0x8583 -0.95694
|
||||
DCW -32138 ; 30 0x8276 -0.98077
|
||||
DCW -32610 ; 31 0x809e -0.99518
|
||||
DCW -32768 ; 32 0x8000 -1.00000
|
||||
DCW -32610 ; 33 0x809e -0.99518
|
||||
DCW -32138 ; 34 0x8276 -0.98077
|
||||
DCW -31357 ; 35 0x8583 -0.95694
|
||||
DCW -30274 ; 36 0x89be -0.92389
|
||||
DCW -28899 ; 37 0x8f1d -0.88193
|
||||
DCW -27246 ; 38 0x9592 -0.83148
|
||||
DCW -25330 ; 39 0x9d0e -0.77301
|
||||
DCW -23170 ; 40 0xa57e -0.70709
|
||||
DCW -20788 ; 41 0xaecc -0.63440
|
||||
DCW -18205 ; 42 0xb8e3 -0.55557
|
||||
DCW -15447 ; 43 0xc3a9 -0.47141
|
||||
DCW -12540 ; 44 0xcf04 -0.38269
|
||||
DCW -9512 ; 45 0xdad8 -0.29028
|
||||
DCW -6393 ; 46 0xe707 -0.19510
|
||||
DCW -3212 ; 47 0xf374 -0.09802
|
||||
DCW 0 ; 48 0x0000 0.00000
|
||||
DCW 3212 ; 49 0x0c8c 0.09802
|
||||
DCW 6393 ; 50 0x18f9 0.19510
|
||||
DCW 9512 ; 51 0x2528 0.29028
|
||||
DCW 12540 ; 52 0x30fc 0.38269
|
||||
DCW 15447 ; 53 0x3c57 0.47141
|
||||
DCW 18205 ; 54 0x471d 0.55557
|
||||
DCW 20788 ; 55 0x5134 0.63440
|
||||
DCW 23170 ; 56 0x5a82 0.70709
|
||||
DCW 25330 ; 57 0x62f2 0.77301
|
||||
DCW 27246 ; 58 0x6a6e 0.83148
|
||||
DCW 28899 ; 59 0x70e3 0.88193
|
||||
DCW 30274 ; 60 0x7642 0.92389
|
||||
DCW 31357 ; 61 0x7a7d 0.95694
|
||||
DCW 32138 ; 62 0x7d8a 0.98077
|
||||
DCW 32610 ; 63 0x7f62 0.99518
|
||||
TabSin
|
||||
DCW 0 ; 0 0x0000 0.00000
|
||||
DCW 3212 ; 1 0x0c8c 0.09802
|
||||
DCW 6393 ; 2 0x18f9 0.19510
|
||||
DCW 9512 ; 3 0x2528 0.29028
|
||||
DCW 12540 ; 4 0x30fc 0.38269
|
||||
DCW 15447 ; 5 0x3c57 0.47141
|
||||
DCW 18205 ; 6 0x471d 0.55557
|
||||
DCW 20788 ; 7 0x5134 0.63440
|
||||
DCW 23170 ; 8 0x5a82 0.70709
|
||||
DCW 25330 ; 9 0x62f2 0.77301
|
||||
DCW 27246 ; 10 0x6a6e 0.83148
|
||||
DCW 28899 ; 11 0x70e3 0.88193
|
||||
DCW 30274 ; 12 0x7642 0.92389
|
||||
DCW 31357 ; 13 0x7a7d 0.95694
|
||||
DCW 32138 ; 14 0x7d8a 0.98077
|
||||
DCW 32610 ; 15 0x7f62 0.99518
|
||||
DCW 32767 ; 16 0x7fff 0.99997
|
||||
DCW 32610 ; 17 0x7f62 0.99518
|
||||
DCW 32138 ; 18 0x7d8a 0.98077
|
||||
DCW 31357 ; 19 0x7a7d 0.95694
|
||||
DCW 30274 ; 20 0x7642 0.92389
|
||||
DCW 28899 ; 21 0x70e3 0.88193
|
||||
DCW 27246 ; 22 0x6a6e 0.83148
|
||||
DCW 25330 ; 23 0x62f2 0.77301
|
||||
DCW 23170 ; 24 0x5a82 0.70709
|
||||
DCW 20788 ; 25 0x5134 0.63440
|
||||
DCW 18205 ; 26 0x471d 0.55557
|
||||
DCW 15447 ; 27 0x3c57 0.47141
|
||||
DCW 12540 ; 28 0x30fc 0.38269
|
||||
DCW 9512 ; 29 0x2528 0.29028
|
||||
DCW 6393 ; 30 0x18f9 0.19510
|
||||
DCW 3212 ; 31 0x0c8c 0.09802
|
||||
DCW 0 ; 32 0x0000 0.00000
|
||||
DCW -3212 ; 33 0xf374 -0.09802
|
||||
DCW -6393 ; 34 0xe707 -0.19510
|
||||
DCW -9512 ; 35 0xdad8 -0.29028
|
||||
DCW -12540 ; 36 0xcf04 -0.38269
|
||||
DCW -15447 ; 37 0xc3a9 -0.47141
|
||||
DCW -18205 ; 38 0xb8e3 -0.55557
|
||||
DCW -20788 ; 39 0xaecc -0.63440
|
||||
DCW -23170 ; 40 0xa57e -0.70709
|
||||
DCW -25330 ; 41 0x9d0e -0.77301
|
||||
DCW -27246 ; 42 0x9592 -0.83148
|
||||
DCW -28899 ; 43 0x8f1d -0.88193
|
||||
DCW -30274 ; 44 0x89be -0.92389
|
||||
DCW -31357 ; 45 0x8583 -0.95694
|
||||
DCW -32138 ; 46 0x8276 -0.98077
|
||||
DCW -32610 ; 47 0x809e -0.99518
|
||||
DCW -32768 ; 48 0x8000 -1.00000
|
||||
DCW -32610 ; 49 0x809e -0.99518
|
||||
DCW -32138 ; 50 0x8276 -0.98077
|
||||
DCW -31357 ; 51 0x8583 -0.95694
|
||||
DCW -30274 ; 52 0x89be -0.92389
|
||||
DCW -28899 ; 53 0x8f1d -0.88193
|
||||
DCW -27246 ; 54 0x9592 -0.83148
|
||||
DCW -25330 ; 55 0x9d0e -0.77301
|
||||
DCW -23170 ; 56 0xa57e -0.70709
|
||||
DCW -20788 ; 57 0xaecc -0.63440
|
||||
DCW -18205 ; 58 0xb8e3 -0.55557
|
||||
DCW -15447 ; 59 0xc3a9 -0.47141
|
||||
DCW -12540 ; 60 0xcf04 -0.38269
|
||||
DCW -9512 ; 61 0xdad8 -0.29028
|
||||
DCW -6393 ; 62 0xe707 -0.19510
|
||||
DCW -3212 ; 63 0xf374 -0.09802
|
||||
|
||||
END
|
Loading…
Reference in a new issue