embeded/Cortex-M3 STM2024. 11. 4. 22:48

왜 안되나 했더니.. 다른 칩에서 계속 pull down 하고 있어서 버튼을 눌러도 올라가지 않았던...

 

cubeide 에서 특정 핀을 GPIO_EXT로 설정하고

 

External Interrupt Mode with ... 로 시작하는 녀석을 고른다.

필요하다면 falling edge 혹은 rising edge에서만도 잡을 수 있는데

 

둘 다 해두면 어떤 이벤트에서 인터럽트가 발생하는지 모르니, 결국에는 인터럽트 핸들러에서

해당 핀의 상태를 읽어서  판별을 해야하나? 조금 복잡한 문제가 발생할 듯 하다.

[링크 : https://blog.naver.com/micomcore/223281042436?]

 

그리고 NVIC 탭에서 해당 인터럽트를 활성화 해준다.

 

아래의 _weak 함수를 재정의 해서 사용하면 끝

GPIO_Pin은 핀 번호 별로 올라오니, 다른 포트의 같은 핀은 구분이 되지 않으니 유의

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  printf("GPIO_Pin[%d]\n", GPIO_Pin);
}

'embeded > Cortex-M3 STM' 카테고리의 다른 글

STM32 timer 사용하기  (0) 2024.12.13
STM32 PWM 으로 LED 점진적으로 깜박이기  (0) 2024.12.13
stm32f103 adc + dma  (0) 2024.11.04
stm32 adc 읽기(1개로 여러 개 채널)  (0) 2024.10.30
stm32 tim output compare(OC) mode  (0) 2024.07.12
Posted by 구차니
embeded/Cortex-M3 STM2024. 11. 4. 14:12

4개의 아날로그 값을 읽어야 해서 고군분투(?) 했는데 

(설정은 아래대로)

 

+ 2024.11.06

Sampling time이 1.5Cycle로 할 경우 다른 채널이 막 섞이는 것 처럼 보인다.

71.5cycle로 하고(@12MHz) 문제없이 작동 확인

+

 

 

의외로 삽질을 한 부분은... "Continuous Conversion Mode"

이걸 켜고 4개 rank에 대해서 dma로 읽으니

1 2 3 4

2 3 4 1

3 4 1 2

식으로 데이터가 하나씩 (조금은 랜덤하게) 밀리는 현상이 발생한다.

 

Sampling Time은 어느 문서에서는 86cycle 이런식으로 길게 하라는데

혹시나 해서 시스템 클럭을 낮게 했는데도 1.5Cycle에서 큰 문제가 없어 보이니, 장기적으로 테스트 해봐야 알 듯.

 

 

[링크 : https://www.st.com/content/dam/kms/Contents/Reflibrary/ADC_Firmware_guide_Mode_and_Feature.pdf]

[링크 : https://www.st.com/content/dam/kms/Contents/Reflibrary/ADC_Firmware_guide_Timer_and_ADC.pdf]

 

84 cycle

[링크 : https://m.blog.naver.com/kiss103007/223043132332]

[링크 : https://blog.naver.com/nextstone/223369997849]

 

+

STM32F4 시리즈는 F1 과는 또 다른 듯?

[링크 : https://m.blog.naver.com/eziya76/221473392732]

 

[링크 : https://www.st.com/resource/en/application_note/an3116-stm32s-adc-modes-and-their-applications-stmicroelectronics.pdf]

Posted by 구차니
embeded/Cortex-M3 STM2024. 10. 30. 19:35

ADC는 3개인데

읽을 핀은 4개라서 어떻게 해야 하나

 

[링크 : https://m.blog.naver.com/gauya/220232257331]

[링크 : https://github.com/sweesineng/STM32_ADC_MultiCh_SingleConv_Polling?tab=readme-ov-file]

 

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32 gpio ext interrupt 모드  (0) 2024.11.04
stm32f103 adc + dma  (0) 2024.11.04
stm32 tim output compare(OC) mode  (0) 2024.07.12
stm32 reset 없이 JTAG 붙이기  (0) 2023.07.19
STM32H/STM32G 시리즈 시리얼 포트 데이터 order  (0) 2022.08.29
Posted by 구차니
embeded/arduino(genuino)2024. 10. 18. 14:25

부품 보다가 가격이 나쁘진 않은데 먼가 해서 보는데

sd 카드가 있는 녀석과 없는 녀석이 존재한다.

별 이야기는 없지만 color LCD 인것 같고

SDcard에서 파일을 읽어서 LCD로 출력도 된다니까

i2c인지 SDIO인지 나중에 봐야 할 듯.

 

[링크 : https://randomnerdtutorials.com/guide-to-1-8-tft-display-with-arduino/]

'embeded > arduino(genuino)' 카테고리의 다른 글

아두이노 FFB 휠 소스코드  (0) 2024.10.11
arducam esp8266 https post 예제  (0) 2024.01.31
433MHz RF 통신  (0) 2023.12.07
아두이노 dht11  (0) 2022.11.14
아두이노 Serial.print()와 Serial.write()  (0) 2022.11.14
Posted by 구차니
embeded/arduino(genuino)2024. 10. 11. 11:45

흐음.. 되어있는걸로 하는게 더 편하려나?

[링크 : https://github.com/ranenbg/Arduino-FFB-wheel]

'embeded > arduino(genuino)' 카테고리의 다른 글

1.8인치 TFT LCD with SDcard  (0) 2024.10.18
arducam esp8266 https post 예제  (0) 2024.01.31
433MHz RF 통신  (0) 2023.12.07
아두이노 dht11  (0) 2022.11.14
아두이노 Serial.print()와 Serial.write()  (0) 2022.11.14
Posted by 구차니
embeded/Cortex-M7 STM2024. 10. 10. 12:38

modbus poll 에서 뜬금없이 crc error로 띄워서 헤맸는데

 

03이나 04 명령어 처럼 multiple byte의 경우에는 아래의 형태로 구성되는데

station_id / cmd / length / data(word) / crc 

 

01의 경우는 아래의 형태로 고정된다.

station_id / cmd / length / data(byte) / crc

 

그러다 보니 modbud poll 에서도 고정된 length에서 하드코딩될수 밖에 없고

0x01 0x01 0x02 0x00 0x00 L_CRC M_CRC 로 응답하면

CRC 부분을 보고 읽는게 아니라

0x00 L_CRC 두개를 CRC로 해석하니 mismatch로 잘못 에러를 출력한다.

 

 

어우.. 별거 아닌데 하루를 날리게 하다니..

'embeded > Cortex-M7 STM' 카테고리의 다른 글

stm32 __weak  (0) 2024.10.08
stm32 modbus  (0) 2024.09.26
SPI NSS, NSSP mode  (0) 2024.09.11
FDE CIE  (0) 2024.09.06
code alignement factor?  (0) 2024.09.06
Posted by 구차니
embeded/Cortex-M7 STM2024. 10. 8. 10:27

인터럽트 핸들러의 경우 __WEAK가 앞에 붙어있는데

c 언어라면 동일한 함수명은 사용이 불가능한게 상식인데

새로 정의하면 새로 정의된 함수가 사용되고 기존에 정의된 함수는 사용되지 않는 신기한 녀석이다

그래서 이 기회에서 찾아보는 중

 

cmsis_armcc.h 에서 아래와 같이 정의되어 있다.

#ifndef   __WEAK
  #define __WEAK                                 __attribute__((weak))
#endif

 

링크 시간에 strong symbol은 weak symbol을 override 한다. 라고 되어있는데

컴파일러가 아니라 링커가 연결해주는거라니 신기하다.

__attribute__((weak)) variable attribute
Generates a weak symbol for a variable, rather than the default symbol.

Syntax

__attribute__((weak)) <type> <variable>;
Parameters
None.

Operation
At link time, strong symbols override weak symbols. This attribute replaces a weak symbol with a strong symbol, by choosing a particular combination of object files to link.

Example

__attribute__((weak)) int foo;

[링크 : https://developer.arm.com/documentation/101754/0622/armclang-Reference/Compiler-specific-Function--Variable--and-Type-Attributes/--attribute----weak---variable-attribute]

 

[링크 : https://blog.naver.com/22wowow22/220825653093]

[링크 : https://gangsanilee.tistory.com/2874]

[링크 : https://tigershin-shinhyeonkyu.tistory.com/8]

[링크 : https://engineering-agit.tistory.com/25]

 

 

'embeded > Cortex-M7 STM' 카테고리의 다른 글

modbus rtu coil read  (0) 2024.10.10
stm32 modbus  (0) 2024.09.26
SPI NSS, NSSP mode  (0) 2024.09.11
FDE CIE  (0) 2024.09.06
code alignement factor?  (0) 2024.09.06
Posted by 구차니
embeded/raspberry pi2024. 10. 7. 19:20

xac가 먼가 했더니 xbox 컨트롤러의 약자인듯.

아무튼 라즈베리 파이 pico 에는 adc가 있으니까 아날로그 입력도 가능할 것 같고

나쁘지 않게 만들수 있을 듯?

 

USB joystick compatible with Xbox Adaptive Controller using Raspberry Pi Pico

[링크 : https://github.com/gdsports/xac_joystick_pipico]

'embeded > raspberry pi' 카테고리의 다른 글

rpi pico sdk  (0) 2025.03.23
라즈베리 파이 pwm 출력  (2) 2024.12.31
cli 에서 chrome refresh 하기  (0) 2024.09.24
라즈베리 파이 gui 재시작(lxde)  (0) 2024.09.19
라즈베리 파이 gui 자동실행  (0) 2024.09.19
Posted by 구차니
embeded/Cortex-M7 STM2024. 9. 26. 16:56

'embeded > Cortex-M7 STM' 카테고리의 다른 글

modbus rtu coil read  (0) 2024.10.10
stm32 __weak  (0) 2024.10.08
SPI NSS, NSSP mode  (0) 2024.09.11
FDE CIE  (0) 2024.09.06
code alignement factor?  (0) 2024.09.06
Posted by 구차니
embeded/raspberry pi2024. 9. 24. 22:20

키보드 달려있으면 f5 누르면 되긴한데 uinput 으로 포커스 잡게 하고 누르는게 나으려나?

lxde 라서 Xorg가 보이긴 한데.. 왜 안될까 ㅠㅠ

 

WID=$(xdotool search --onlyvisible --class chromium|head -1)
xdotool windowactivate ${WID}
xdotool key ctrl+F5

[링크 : https://forums.raspberrypi.com/viewtopic.php?t=52613]

 

이걸 해주고 해도 동일한 에러가 발생한다.

$ xauth list $DISPLAY 
This prints the cookie, something like this:

pi:10 mit-magic-cookie-1 4d22408aga55sad1ccd165723g77923ae
Then switch the superuser with su and set the cookie:

# xauth add pi:10 mit-magic-cookie-1 4d22408aga55sad1ccd165723g77923ae 

[링크 : https://raspberrypi.stackexchange.com/questions/1719/x11-connection-rejected-because-of-wrong-authentication]

 

이걸 써봐야 하나..

gksu - GTK+ frontend for su and sudo

[링크 : https://linux.die.net/man/1/gksudo]

[링크 : https://discourse.ubuntu-kr.org/t/sudo-gksudo/23916]

 

+

라즈베리에서 하니(xfce) 안된다. 도대체 머가 문제일까..

$ xdotool search chromium
Defaulting to search window name, class, and classname
10485760


$ xdotool windowactivate 10475760
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  20 (X_GetProperty)
  Resource id in failed request:  0x9fd8f0
  Serial number of failed request:  26
  Current serial number in output stream:  26


$ xdotool windowactivate 10485760
XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)

$ xdotool key ctrl+F5

 

두개 명령을 한번에 할 수도 있는 듯. 일단 에러는 발생하지 않네..?

Try:

wid=`xdotool search "FILENAME"`
xdotool windowactivate $wid
in:

xdotool search "FILENAME" windowactivate --sync

[링크 : https://stackoverflow.com/questions/36921889/check-for-duplicate-application-in-linux-bat]

 

xdotool mousemove --screen 2 --polar 0 0 

[링크 : https://github.com/jordansissel/xdotool/issues/67]

 

별별 희한한 작동이 가능하네?

$ xdotool --help
Available commands:
  getactivewindow
  getwindowfocus
  getwindowname
  getwindowpid
  getwindowgeometry
  getdisplaygeometry
  search
  selectwindow
  help
  version
  behave
  behave_screen_edge
  click
  getmouselocation
  key
  keydown
  keyup
  mousedown
  mousemove
  mousemove_relative
  mouseup
  set_window
  type
  windowactivate
  windowfocus
  windowkill
  windowclose
  windowmap
  windowminimize
  windowmove
  windowraise
  windowreparent
  windowsize
  windowunmap
  set_num_desktops
  get_num_desktops
  set_desktop
  get_desktop
  set_desktop_for_window
  get_desktop_for_window
  get_desktop_viewport
  set_desktop_viewport
  exec
  sleep
Posted by 구차니