Application - Joystick

出自 flip the world
於 2018年8月22日 (三) 23:37 由 Tommy (對話 | 貢獻) 所做的修訂 (已建立頁面,內容為 "thumb|200px|Joysticks module == HW connection & Timing == <pre> Module STM32F4 ===================== GND GND 5v…")
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)
前往: 導覽搜尋
Joysticks module

HW connection & Timing

Module        STM32F4
=====================
GND           GND 
5v            5v
VRX           PA0 - GPIO(ADC)
VRY           PA1 - GPIO(ADC)
SW            PE14 - GPIO(Interrupt)

ADC DMA

HAL_ADC_Start_DMA(&hadc1, (uint32_t*)ADC_Buffer, 2);

GDB for ADC

console 1

tommy@tommy-HP-EliteBook-Folio-1040-G2:~/projects/mbed/ST/stlink.git$ sudo ./st-util 
2016-07-10T14:40:18 INFO src/stlink-common.c: Loading device parameters....
2016-07-10T14:40:18 INFO src/stlink-common.c: Device connected is: F4 device, id 0x10016413
2016-07-10T14:40:18 INFO src/stlink-common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 16384 bytes
2016-07-10T14:40:18 INFO gdbserver/gdb-server.c: Chip ID is 00000413, Core ID is  2ba01477.
2016-07-10T14:40:18 INFO gdbserver/gdb-server.c: Target voltage is 2905 mV.
2016-07-10T14:40:18 INFO gdbserver/gdb-server.c: Listening at *:4242...
2016-07-10T14:40:18 INFO gdbserver/gdb-server.c: Found 6 hw breakpoint registers
2016-07-10T14:40:18 INFO gdbserver/gdb-server.c: GDB connected.

console 2

tommy@tommy-HP-EliteBook-Folio-1040-G2:~/projects/mbed/ST/stm32cubef4.svn/Projects/STM32F4-Discovery/Applications/max7219_x4/SW4STM32/max7219_x4/Debug$ arm-none-eabi-gdb max7219_x4.elf 
GNU gdb (7.8-0ubuntu1+6) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
0x08004a70 in ?? ()
/home/tommy/.gdbinit:8: Error in sourced command file:
No executable file specified.
Use the "file" or "exec-file" command.
Reading symbols from max7219_x4.elf...done.
(gdb) tar extended-remote :4242
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /home/tommy/projects/mbed/ST/stm32cubef4.svn/Projects/STM32F4-Discovery/Applications/max7219_x4/SW4STM32/max7219_x4/Debug/max7219_x4.elf 

//After programming, press Ctrl + C to stop in somewhere
^C
^CQuit
(gdb) bt
#0  0x080027d6 in HAL_Delay (Delay=Delay@entry=100)
    at /home/tommy/projects/mbed/ST/stm32cubef4.svn/Projects/STM32F4-Discovery/Applications/max7219_x4/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c:342
#1  0x08003d1a in StartDefaultTask (argument=<optimized out>)
    at /home/tommy/projects/mbed/ST/stm32cubef4.svn/Projects/STM32F4-Discovery/Applications/max7219_x4/Src/main.c:761
#2  0x08000d30 in uxListRemove (pxItemToRemove=<optimized out>)
    at /home/tommy/projects/mbed/ST/stm32cubef4.svn/Projects/STM32F4-Discovery/Applications/max7219_x4/Middlewares/Third_Party/FreeRTOS/Source/list.c:238
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

//Watch DMA variable
(gdb) print ADC_Buffer //no action
$6 = {2364, 2434}
(gdb) print ADC_Buffer //VRX to left end
$7 = {18, 2440}
(gdb) print ADC_Buffer //VRX to right end
$9 = {4095, 2436}
(gdb) print ADC_Buffer //VRY to up end
$10 = {3119, 13}
(gdb) print ADC_Buffer //VRY to down end
$11 = {2349, 4095}
(gdb)