'embeded'에 해당되는 글 1492건

  1. 2025.06.05 stm32 pwm 주파수 계산
  2. 2025.06.05 stm32 timer로 gpio 토글하기
  3. 2025.06.02 stm32 pwm interrupt
  4. 2025.05.29 stm32 stop mode - main thread
  5. 2025.05.13 stm32 boot loader(shipping)
  6. 2025.05.08 stm32flash
  7. 2025.05.08 renesas ra6 rfp-cli
  8. 2025.04.25 로봇 tcp 확인
  9. 2025.04.01 nxp g2d_blit
  10. 2025.03.26 stm32 timer로 gpio 에 연결된 led on/off
embeded/Cortex-M3 STM2025. 6. 5. 21:08

귀찮아서 50% duty로 하면 아래와 같이 계산하면 된다.

mcu 클럭을 기준으로 period 값을 변수로 넣어 되긴 한데...

  int mcu_clk = 8000000; // 8M Hz
  int freq_calc = mcu_clk / (freq * 10);

  TIM_OC_InitTypeDef sConfigOC = {0};
      htim3.Instance = TIM3;
      htim3.Init.Prescaler = freq_calc - 1;  // PSC - 20k
      htim3.Init.Period = 10-1; // ARR? - 4k
      sConfigOC.Pulse = 5-1;  // CCR

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

stm32 cubeide ioc gen  (0) 2025.06.18
stm32 uart tx dma  (0) 2025.06.18
stm32 timer로 gpio 토글하기  (0) 2025.06.05
stm32 pwm interrupt  (0) 2025.06.02
stm32 stop mode - main thread  (0) 2025.05.29
Posted by 구차니
embeded/Cortex-M3 STM2025. 6. 5. 11:34

timer 가 빠르고 빈번하게 설정되는게 아니라면 큰 문제는 없는데

희한하게 gpio 함수가 무거운가 timer 에서 직접 HAL_GPIO 함수를 호출하기 보다는

플래그를 설정하고 메인루프에서 값을 보고 바꾸는 편인데 되긴하나 보...다?

 

[링크 : https://blognavercomcheetah254.tistory.com/137]

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

stm32 uart tx dma  (0) 2025.06.18
stm32 pwm 주파수 계산  (0) 2025.06.05
stm32 pwm interrupt  (0) 2025.06.02
stm32 stop mode - main thread  (0) 2025.05.29
stm32 boot loader(shipping)  (0) 2025.05.13
Posted by 구차니
embeded/Cortex-M3 STM2025. 6. 2. 17:23

그나저나 stm32f4xx_hal_tim.c 에서 내가 만든 파일의 함수를 호출하게해서

pwm이 끝나면 카운트를 갂아 원하는 횟수만큼 소리내려고 했는데

interrupt 내에서 호출한 변수가 증가만 하고 리셋되지 않는 이상한 현상이 발생

해결책은 나중에 찾아봐야겠다.

/* stm32f4xx_hal_tim.c */


void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim)
{
  ...중략
  /* TIM Update event */
  if(__HAL_TIM_GET_FLAG(htim, TIM_FLAG_UPDATE) != RESET)
  {
    if(__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_UPDATE) !=RESET)
    {
      __HAL_TIM_CLEAR_IT(htim, TIM_IT_UPDATE);
      HAL_TIM_PeriodElapsedCallback(htim);
    }
  }
  ...중략
}

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

 

__HAL_TIM_CLEAR_IT(&htim3, TIM_IT_UPDATE);
__HAL_TIM_ENABLE_IT(&htim3, TIM_IT_UPDATE);

void TIM3_IRQHandler(void)
{
    if (__HAL_TIM_GET_FLAG(&htim3, TIM_FLAG_UPDATE)) {
        __HAL_TIM_CLEAR_IT(&htim3, TIM_IT_UPDATE);
        // PWM 1회 출력 후 이벤트 처리
    }
}

 

쉬운 방법으로 One pulse mode도 있다

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

stm32 pwm 주파수 계산  (0) 2025.06.05
stm32 timer로 gpio 토글하기  (0) 2025.06.05
stm32 stop mode - main thread  (0) 2025.05.29
stm32 boot loader(shipping)  (0) 2025.05.13
stm32flash  (0) 2025.05.08
Posted by 구차니
embeded/Cortex-M3 STM2025. 5. 29. 10:54

stm32 에서 gpio 핸들러에다가 stop mode 들어가게 해놨더니 작동안되서 찾아보니

main thread에서 stop이 들어가야 작동한다고 한다.

 

flag 세워주고 main loop에서 처리하면 끝

[링크 : https://community.st.com/t5/stm32-mcus-products/enter-exit-stop-mode-with-one-gpio-pin/td-p/621929]

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

stm32 timer로 gpio 토글하기  (0) 2025.06.05
stm32 pwm interrupt  (0) 2025.06.02
stm32 boot loader(shipping)  (0) 2025.05.13
stm32flash  (0) 2025.05.08
stm32 timer로 gpio 에 연결된 led on/off  (0) 2025.03.26
Posted by 구차니
embeded/Cortex-M3 STM2025. 5. 13. 14:03

예전에도 넣어줬던가 모르겠네

2.3.8 Boot modes
At startup, boot pins are used to select one of three boot options:
• Boot from user Flash
• Boot from system memory
• Boot from embedded SRAM
The bootloader is located in the system memory. It is used to reprogram the flash memory by using USART1. For further details, refer to AN2606, available on www.st.com.

[링크  https://www.st.com/resource/en/datasheet/cd00161566.pdf]

[링크  https://www.st.com/resource/en/application_note/an2606-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf]

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

stm32 pwm interrupt  (0) 2025.06.02
stm32 stop mode - main thread  (0) 2025.05.29
stm32flash  (0) 2025.05.08
stm32 timer로 gpio 에 연결된 led on/off  (0) 2025.03.26
stm32 sleep mode  (0) 2025.03.10
Posted by 구차니
embeded/Cortex-M3 STM2025. 5. 8. 17:22

리눅스 배포판에 포함된 stm32용 bootloader용 uart / i2c 업데이트 프로그램

나중에 한번 써봐야지

 

stm32flash - flashing utility for STM32 through UART or I2C

[링크  https://manpages.ubuntu.com/manpages/bionic/man1/stm32flash.1.html]

[링크  https://sourceforge.net/p/stm32flash/wiki/Home/]

 

 

 

 

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

stm32 stop mode - main thread  (0) 2025.05.29
stm32 boot loader(shipping)  (0) 2025.05.13
stm32 timer로 gpio 에 연결된 led on/off  (0) 2025.03.26
stm32 sleep mode  (0) 2025.03.10
STM32 float point support 활성화시 %f 출력 NaN  (0) 2025.03.07
Posted by 구차니
embeded/renesas2025. 5. 8. 16:45

리눅스(x86) 에서 작동 확인

 

$ ./rfp-cli -device RA -port /dev/ttyUSB0 -read dump.bin
Renesas Flash Programmer CLI V1.12
Module Version: V3.19.00.000

Connecting the tool (COM port)
Tool: /dev/ttyUSB0
Interface: 2 wire UART

Connecting the target device
Speed: 115,200 bps
Connected

Reading data from the device
  [Code Flash 1]       00000000 - 001FFFFF
  93% [======================================================>     ]

 

-device 옵션은 필수로 들어가야 하고

 

메뉴얼을 보면 도구에서 uart가 있어야 할 것 같은데 이건 아예 지정하지 않아도 된다.

 

장치와 접속 방법만 알려주면 작동할 용도가 없어서 no operation 뜨고 종료된다.

$ ./rfp-cli -device RA -port /dev/ttyUSB0
Renesas Flash Programmer CLI V1.12
Module Version: V3.19.00.000

Connecting the tool (COM port)
Tool: /dev/ttyUSB0
Interface: 2 wire UART


Disconnecting the tool

No operation

 

-write* 은 특정 영역에 값을 쓸 수 있고

-write32 <addr> <data>[,<data>...]
-writebit <addr> <pos> <bitdata>

 

-read 는 읽어서 파일에 쓸 수 있고

-read <file>, -r <file>
-read-bin <addr> <size> <file>, -rb <addr> <size> <file>
-read-view <addr> <size>, -rv <addr> <size>

 

-erase , -program 으로 장치를 삭제할 수 있다.

-erase, -e Erases flash memory of the device.
-program, -p Erases the range for writing to the device and writes to the device.
-erase-chip Erases all data in the flash memory of the device and clears the configuration settings.

 

파일 지정은 가장 마지막에 해주면 된다.

rfp-cli [option...] [hexfile...]

 

 

Posted by 구차니
embeded/robot2025. 4. 25. 09:05

rx ry rz 를 조작하면

공구 위치를 고정된채 로봇팔이 움직인다고 한다.

 

[링크 : https://youtu.be/QgsWCznw8Oo?si=EcLhJN2PKbRUtLBk]

'embeded > robot' 카테고리의 다른 글

로봇 좌표계, TCP ... 2?  (0) 2024.09.02
elephantrobotics Mycobot-pi atom  (0) 2024.07.11
elephant robotics cobot python api  (0) 2023.12.21
산업로봇과 협동로봇의 차이  (0) 2023.12.21
오일러 각 / 짐벌락 / 쿼터니언  (0) 2023.12.21
Posted by 구차니
embeded/i.mx 8m plus2025. 4. 1. 18:28

하.. 성능 땜시 blit 함수 찾았는데

nxp 의 i.mx6 및 imx8 에서도 사용이 가능한 라이브러리가 존재한다.

그나저나 i.mx9이 imx8quad max 보다는 떨어지고 나머지 i.mx8 시리즈 보단 나은 신기한 구성이다.

[링크 : https://www.nxp.com/docs/en/user-guide/IMX_GRAPHICS_USERS_GUIDE.pdf]

 

원하던 함수는 바로 이것. 그런데 user guide지 application note 가 아니라 함수만 설명하고 상세 인자 설명은 없는 상황..

[링크 : https://www.nxp.com/docs/en/user-guide/IMX_GRAPHICS_USERS_GUIDE.pdf]

 

뒤지면 나오긴 한데.. 크흡..

[링크 : https://github.com/nxp-imx/g2d-samples]

    [링크 : https://github.com/nxp-imx/g2d-samples/blob/imx_2.3/multiblit_test/g2d_multiblit.c]

[링크 : https://community.nxp.com/t5/i-MX-Processors/g2d-alloc-alloc-memory-fail-with-size-6220800/m-p/451245]

 

Posted by 구차니
embeded/Cortex-M3 STM2025. 3. 26. 15:17

pwm 에서는 안되던데 아래 함수는 되려나?

 

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
    GAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin); 
}

[링크 : https://www.youtube.com/watch?v=sdr0EFT2LqU]

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

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

stm32 boot loader(shipping)  (0) 2025.05.13
stm32flash  (0) 2025.05.08
stm32 sleep mode  (0) 2025.03.10
STM32 float point support 활성화시 %f 출력 NaN  (0) 2025.03.07
STM32 timer 사용하기  (0) 2024.12.13
Posted by 구차니