Debut DFT

This commit is contained in:
Axel Olougouna 2023-04-21 18:17:34 +02:00
parent 4bd67ca4f1
commit 0ebfe3d25d
11 changed files with 239 additions and 106 deletions

View file

@ -1,6 +1,6 @@
PRESERVE8
THUMB
include Driver/DriverJeuLaser.inc
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
@ -13,7 +13,7 @@
; ===============================================================================================
EXPORT DFT_ModuleAuCarre
@ -21,7 +21,37 @@
area moncode,code,readonly
; écrire le code ici
DFT_ModuleAuCarre proc
push{lr, r4,r5, r6, r7}
mov r2, r0 ; mettre l'adresse du signal dans r2
mov r0, #0 ; r0 peut être utilisé ;dans r1 on a la valeur de k
ldr r4,=TabCos
mov r5, #0 ; contient notre indice n
Boucle
cmp r5,#64
ble Fin
ldrsh r3,[r2, r5, LSL #1] ; x[n] ; là format 4.12
mul r6, r1, r5 ; kn
and r6, r6, #63 ; kn & 000000000011111
ldrsh r7,[r4, r6, LSL #1] ; TabCos[kn] ; là format 1.15
mul r3, r3, r7 ; x[n]*TabCos[n] 5.27
asr r3, r3, #6 ; 5.21
asr r0, r0, #6 ; 5.21
;mla r0, r7, r3, r0 ; x(k) += x[n]*TabCos[n] ;11.27
add r0, r0, r3 ; 6.21
add r5, #1
bl Boucle
Fin
asr r0, r0, #16
mul r0, r0, r0 ; 5.
pop{pc, r4, r5, r6, r7}
endp

View file

@ -0,0 +1,67 @@
PRESERVE8
THUMB
include Driver/DriverJeuLaser.inc
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
area mesdata,data,readonly
extern TabCos
extern LeSignal
;Section RAM (read write):
area maram,data,readwrite
; ===============================================================================================
;Section ROM code (read only) :
area moncode,code,readonly
; écrire le code ici
EXPORT DFT_ModuleAuCarre
DFT_ModuleAuCarre proc
push {lr}
ldr r0,=Son
ldr r1,=LongueurSon
ldr r1,[r1]
ldr r3,=Index ;on met l'adr d'Index dans r3
ldrh r2,[r3]
cmp r1,r2
ble Fin
push{r4,r5}
ldrsh r0,[r0,r2, LSL #1]; en C Son[Index]
add r2, r2, #1
strh r2,[r3] ; maj Index
mov r1, #32768
add r0, r0, r1
mov r4, #719
mul r0, r0, r4
asr r0, r0, #16
ldr r5,=SortieSon
str r0,[r5]
bl PWM_Set_Value_TIM3_Ch3
pop{r4,r5}
Fin
pop {pc}
endp
END

View file

@ -3,10 +3,13 @@
#include "DriverJeuLaser.h"
extern short int LeSignal;
extern int DFT_ModuleAuCarre(short int* Signal64ech, char k);
int main(void)
{
int tab[64];
// ===========================================================================
// ============= INIT PERIPH (faites qu'une seule fois) =====================
// ===========================================================================
@ -14,8 +17,10 @@ int main(void)
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
CLOCK_Configure();
for(int i=0; i<64; i++){
tab[i] = DFT_ModuleAuCarre(&LeSignal, i);
}
//============================================================================

View file

@ -75,7 +75,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
@ -267,7 +267,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
@ -624,6 +624,30 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\Src\DFT.s</PathWithFileName>
<FilenameWithoutPath>DFT.s</FilenameWithoutPath>
<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\Signal.asm</PathWithFileName>
<FilenameWithoutPath>Signal.asm</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
@ -634,7 +658,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>2</FileNumber>
<FileNumber>4</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -654,7 +678,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>3</FileNumber>
<FileNumber>5</FileNumber>
<FileType>4</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>

View file

@ -388,6 +388,16 @@
<FileType>1</FileType>
<FilePath>.\Src\principal.c</FilePath>
</File>
<File>
<FileName>DFT.s</FileName>
<FileType>2</FileType>
<FilePath>.\Src\DFT.s</FilePath>
</File>
<File>
<FileName>Signal.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\Signal.asm</FilePath>
</File>
</Files>
</Group>
<Group>
@ -797,6 +807,16 @@
<FileType>1</FileType>
<FilePath>.\Src\principal.c</FilePath>
</File>
<File>
<FileName>DFT.s</FileName>
<FileType>2</FileType>
<FilePath>.\Src\DFT.s</FilePath>
</File>
<File>
<FileName>Signal.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\Signal.asm</FilePath>
</File>
</Files>
</Group>
<Group>
@ -1275,6 +1295,16 @@
<FileType>1</FileType>
<FilePath>.\Src\principal.c</FilePath>
</File>
<File>
<FileName>DFT.s</FileName>
<FileType>2</FileType>
<FilePath>.\Src\DFT.s</FilePath>
</File>
<File>
<FileName>Signal.asm</FileName>
<FileType>2</FileType>
<FilePath>.\Src\Signal.asm</FilePath>
</File>
</Files>
</Group>
<Group>

View file

@ -0,0 +1,2 @@
extern void CallbackSon(void);
extern void StartSon(void);

View file

@ -0,0 +1,2 @@
extern void CallbackSon(void);
extern void StartSon(void);

View file

@ -12,7 +12,7 @@
;Section RAM (read write):
area maram,data,readwrite
SortieSon dcw 0
SortieSon dcd 0
Index dcw 0
; ===============================================================================================
@ -26,7 +26,8 @@ Index dcw 0
EXPORT CallbackSon
EXPORT SortieSon
EXPORT Index
;EXPORT Index
EXPORT StartSon
CallbackSon proc
push {lr}
@ -52,16 +53,28 @@ CallbackSon proc
asr r0, r0, #16
ldr r5,=SortieSon
strh r0,[r5]
str r0,[r5]
bl PWM_Set_Value_TIM3_Ch3
pop{r4,r5}
pop{pc}
Fin
pop {pc}
endp
StartSon proc
push {lr}
ldr r0,=Index
mov r1, #0
strh r1,[r0]
pop {pc}
endp
END

View file

@ -1,9 +1,10 @@
#include "DriverJeuLaser.h"
#include "GestionSon.h"
int bouton = 0;
extern void CallbackSon(void);
int main(void)
{
@ -15,14 +16,20 @@ int main(void)
CLOCK_Configure();
Timer_1234_Init_ff(TIM4, 6552);
Active_IT_Debordement_Timer(TIM4, 2, CallbackSon);
Active_IT_Debordement_Timer(TIM4, 2, CallbackSon);
PWM_Init_ff( TIM3, 3, 720);
GPIO_Configure(GPIOB, 0, OUTPUT, ALT_PPULL);
//============================================================================
while (1)
{
if( bouton == 1){
StartSon();
bouton = 0;
}
}
}

View file

@ -75,7 +75,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
@ -153,88 +153,7 @@
<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>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>32</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134220068</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>\\StepSon\Src/GestionSon.s\32</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>52</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134220110</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>\\StepSon\Src/GestionSon.s\52</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>54</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134220114</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>\\StepSon\Src/GestionSon.s\54</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>57</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134220118</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>\\StepSon\Src/GestionSon.s\57</Expression>
</Bp>
<Bp>
<Number>4</Number>
<Type>0</Type>
<LineNumber>55</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134220116</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>\\StepSon\Src/GestionSon.s\55</Expression>
</Bp>
</Breakpoint>
<Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>
@ -250,7 +169,7 @@
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>256</SubType>
<SubType>260</SubType>
<ItemText>0x200000a0</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
@ -261,7 +180,7 @@
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>1</aLwin>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
@ -275,7 +194,7 @@
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>1</aLa>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
@ -301,12 +220,12 @@
<Wi>
<IntNumber>0</IntNumber>
<FirstString>((portb &amp; 0x00000002) &gt;&gt; 1 &amp; 0x2) &gt;&gt; 1</FirstString>
<SecondString>FF000000000000000000000000000000E0FFEF400000000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000922449922449E23F030000000000000000000000000000000000000096020008</SecondString>
<SecondString>FF000000000000000000000000000000E0FFEF400000000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000922449922449E23F150000000000000000000000000000000000000096020008</SecondString>
</Wi>
<Wi>
<IntNumber>1</IntNumber>
<FirstString>`SortieSon</FirstString>
<SecondString>0080000000000000000000000000001D0488B54100000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000002000000DBB66DDBB66DDB3F030000000000000000000000000000000000000000090008</SecondString>
<SecondString>008000000000000000000000000000000070864000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000002000000DBB66DDBB66DDB3F150000000000000000000000000000000000000000090008</SecondString>
</Wi>
</LogicAnalyzers>
<DebugDescription>
@ -373,7 +292,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
@ -452,6 +371,13 @@
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>bouton</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
@ -466,7 +392,7 @@
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>1</aLwin>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
@ -802,6 +728,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>6</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\Src\GestionSon.h</PathWithFileName>
<FilenameWithoutPath>GestionSon.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>

View file

@ -423,6 +423,11 @@
<FileType>2</FileType>
<FilePath>.\Src\GestionSon.s</FilePath>
</File>
<File>
<FileName>GestionSon.h</FileName>
<FileType>5</FileType>
<FilePath>.\Src\GestionSon.h</FilePath>
</File>
</Files>
</Group>
<Group>
@ -434,7 +439,7 @@
<TargetName>CibleSondeKEIL</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060750::V5.06 update 6 (build 750)::.\ARMCC</pCCUsed>
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
@ -847,6 +852,11 @@
<FileType>2</FileType>
<FilePath>.\Src\GestionSon.s</FilePath>
</File>
<File>
<FileName>GestionSon.h</FileName>
<FileType>5</FileType>
<FilePath>.\Src\GestionSon.h</FilePath>
</File>
</Files>
</Group>
<Group>
@ -1340,6 +1350,11 @@
<FileType>2</FileType>
<FilePath>.\Src\GestionSon.s</FilePath>
</File>
<File>
<FileName>GestionSon.h</FileName>
<FileType>5</FileType>
<FilePath>.\Src\GestionSon.h</FilePath>
</File>
</Files>
</Group>
<Group>