embeded/Cortex-M3 STM2025. 6. 27. 17:27

iwdg가 wdg_sw 설정되는줄 알았는데.. iwdg가 software랑 hardware로 나눠지는 듯.. 찾아봐야겠네

 

Option Byte는 아래의 api를 통해 접근할수 있고

HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit)

 

UserConfig 변수내에 bit 단위로 설정되도록 되어있다.

typedef struct
{
uint32_t OptionType; /*!< OptionType: Option byte to be configured.
This parameter can be a value of @ref FLASHEx_OB_Type */

uint32_t WRPState; /*!< WRPState: Write protection activation or deactivation.
This parameter can be a value of @ref FLASHEx_OB_WRP_State */

uint32_t WRPPage; /*!< WRPPage: specifies the page(s) to be write protected
This parameter can be a value of @ref FLASHEx_OB_Write_Protection */

uint32_t Banks; /*!< Select banks for WRP activation/deactivation of all sectors.
This parameter must be a value of @ref FLASHEx_Banks */
 
uint8_t RDPLevel; /*!< RDPLevel: Set the read protection level..
This parameter can be a value of @ref FLASHEx_OB_Read_Protection */

#if defined(FLASH_BANK2_END)
uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte:
IWDG / STOP / STDBY / BOOT1
This parameter can be a combination of @ref FLASHEx_OB_IWatchdog, @ref FLASHEx_OB_nRST_STOP,
@ref FLASHEx_OB_nRST_STDBY, @ref FLASHEx_OB_BOOT1 */
#else
uint8_t USERConfig; /*!< USERConfig: Program the FLASH User Option Byte:
IWDG / STOP / STDBY
This parameter can be a combination of @ref FLASHEx_OB_IWatchdog, @ref FLASHEx_OB_nRST_STOP,
@ref FLASHEx_OB_nRST_STDBY */
#endif /* FLASH_BANK2_END */

uint32_t DATAAddress; /*!< DATAAddress: Address of the option byte DATA to be programmed
This parameter can be a value of @ref FLASHEx_OB_Data_Address */
 
uint8_t DATAData; /*!< DATAData: Data to be stored in the option byte DATA
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */
} FLASH_OBProgramInitTypeDef;

 

STOP 모드 들어가면 리셋걸리지 않게 하려면 해당 OB로 설정해주어야 하나..

/** @defgroup FLASHEx_OB_IWatchdog Option Byte IWatchdog
* @{
*/
#define OB_IWDG_SW ((uint16_t)0x0001) /*!< Software IWDG selected */
#define OB_IWDG_HW ((uint16_t)0x0000) /*!< Hardware IWDG selected */
/**
* @}
*/

/** @defgroup FLASHEx_OB_nRST_STOP Option Byte nRST STOP
* @{
*/
#define OB_STOP_NO_RST ((uint16_t)0x0002) /*!< No reset generated when entering in STOP */
#define OB_STOP_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STOP */
/**
* @}
*/

/** @defgroup FLASHEx_OB_nRST_STDBY Option Byte nRST STDBY
* @{
*/
#define OB_STDBY_NO_RST ((uint16_t)0x0004) /*!< No reset generated when entering in STANDBY */
#define OB_STDBY_RST ((uint16_t)0x0000) /*!< Reset generated when entering in STANDBY */

 

HAL_FLASHEx_OBGetConfig()
HAL_FLASH_OB_Unlock()
HAL_FLASH_Unlock()
HAL_FLASH_OB_Launch()

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

[링크 : https://community.st.com/t5/stm32-mcus/how-to-program-stm32-option-bytes-with-the-hal-api/ta-p/49660]

 

IWDG는 option byte에 설정 가능 - 설정하면 리부팅 필요 혹은 강제로 리부팅됨

[링크 : https://m.blog.naver.com/kim1417/221461254045]

[링크 : https://pineenergy.tistory.com/138]

 

The Independent watchdog can not be stopped in any processor mode. You have to wake up regularly to reload the watchdog. What you can do is change the prescaler to maximum so the watchdog is counting slowly.
IWDG will only be stopped if you disconnect the controller from the power supply.

[링크 : https://stackoverflow.com/questions/53334571/disabling-stm32-hal-iwdg-or-wwdg-watchdog-before-stop-mode]

 

stm32g 의 경우인데 f에 없는 플래그가 존재한다.

[링크 : https://community.st.com/t5/stm32-mcus-products/iwdg-disable-during-sleep-stop/td-p/95106]

 

+

2025.07.31

stm32f1xx_hal.h 에서 찾은 건데..

FREEZE 로 된걸 해주면 stp 모드에서 동결되려나? 그런데 debug mode 래서 언제 쓸수 있는지 찾아봐야 할 듯.

/**
* @brief WWDG Peripherals Debug mode
*/
#define __HAL_DBGMCU_FREEZE_WWDG() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP)
#define __HAL_DBGMCU_UNFREEZE_WWDG() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP)

/**
* @brief IWDG Peripherals Debug mode
*/
#define __HAL_DBGMCU_FREEZE_IWDG() SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP)
#define __HAL_DBGMCU_UNFREEZE_IWDG() CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP)

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

stm32cubeide build analyzer  (0) 2025.07.21
stm32 wwdg, iwdg 차이  (0) 2025.06.30
stm32 cubeide ioc gen  (0) 2025.06.18
stm32 uart tx dma  (0) 2025.06.18
stm32 pwm 주파수 계산  (0) 2025.06.05
Posted by 구차니
embeded/FPGA - XILINX2025. 6. 27. 16:16

pynq가 더 싸게 팔리는데 차이가 없다면 pynq를 사서 arty 이미지를 써서 가지고 노는것도 방법일 듯?

 

Between PYNQ Z1 and Arty Z7, the only difference is that the PYNQ has a microphone and Arty Z7 doesn't, otherwise they are identical from the specs point of view.

[링크 : https://forum.digilent.com/topic/20727-what-zynq-7020-board-would-you-recommend-zybo-arty-z7-pynq-z1/]

[링크 : https://www.reddit.com/r/FPGA/comments/fkumbh/is_the_arty_a7_or_a_similarly_priced_zynq_board/]

 

 

arty z7의 경우

HDMI in / out이 있는게 장점 인듯.

[링크 : https://digilent.com/reference/learn/programmable-logic/tutorials/arty-z7-hdmi-in-demo?srsltid=AfmBOop1w1FTtQP9bF_ssIaZuOXVLJhOrn1Kda292FBD_9-p5f0ogsbE]

'embeded > FPGA - XILINX' 카테고리의 다른 글

zynq vitis openCL  (0) 2025.06.27
EBAZ4205 zynq  (0) 2025.03.25
xilinx vdma  (0) 2025.01.16
ftdi jtag  (0) 2023.07.22
xilinx zynq jtag  (2) 2023.07.21
Posted by 구차니
embeded/FPGA - XILINX2025. 6. 27. 16:06

대충(?) 보기에는

openCL로 작성한 kernel을 vivado hls 에서 읽어들여

하드웨어로 synthesis 하고 그걸 메모리에 연결해서(AXI) 그냥 제어해버리는 컨셉인 듯

 

그렇게 생겨난 IP를 회로로 구성해서 zynq에 넣어서 작동하면 끝

[링크 : https://svenssonjoel.github.io/pages/zynq_hls_opencl/index.html]

'embeded > FPGA - XILINX' 카테고리의 다른 글

pynq 와 arty  (0) 2025.06.27
EBAZ4205 zynq  (0) 2025.03.25
xilinx vdma  (0) 2025.01.16
ftdi jtag  (0) 2023.07.22
xilinx zynq jtag  (2) 2023.07.21
Posted by 구차니
embeded/FPGA - ALTERA2025. 6. 27. 16:05

하나 갖고 싶긴한데... 매물도 잘 없고 비싸단 말이지..

[링크 : https://download.terasic.com/downloads/cd-rom/de1-soc/linux_BSP/OPENCL18.1/DE1-SoC_OpenCL_v05.pdf]

 

통합되어 있진 않지만 openCL kernel을 작성하고

AOCL(altera offline compiler)를 통해서 aocx가 나오면 그걸 fpga에 올려서 돌리는 듯?

[링크 : https://ftp.intel.com/Public/Pub/fpgaup/pub/Teaching_Materials/current/Tutorials/OpenCL_On_DE_Series_Boards.pdf]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

terasic sockit  (0) 2023.11.06
HSMC(High Speed Mezzanine Card)  (0) 2023.10.02
altera(intel fpga) m9k m10k  (0) 2023.05.14
altera uart ip  (0) 2023.05.14
altera - partial reconfigure  (0) 2023.04.24
Posted by 구차니
embeded/Cortex-M3 STM2025. 6. 18. 11:11

실수로 자동으로 물어보는걸 꺼버렸더니.. 귀찮아졌다.

일단 ioc 수정 후, 저장, 우클릭 generate code

 

근데 상단에 톱니바퀴가 동일한 기능..

 

[링크 : https://blog.naver.com/chandong83/222863872771]

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

stm32 wwdg, iwdg 차이  (0) 2025.06.30
stm32f wwdg iwdg 그리고 stop mode  (0) 2025.06.27
stm32 uart tx dma  (0) 2025.06.18
stm32 pwm 주파수 계산  (0) 2025.06.05
stm32 timer로 gpio 토글하기  (0) 2025.06.05
Posted by 구차니
embeded/Cortex-M3 STM2025. 6. 18. 11:09

stm32 에서 uart tx를 dma로 구현하기

 

connectivity - usart 에서

DMA Settings에서 Add

 

TX를 DMA로 할거니까 USART1_TX를 선택

 

uart니까 우선순위가 높을 이유도 없으니 그냥 기본으로 하고, 바이트 단위로 증가가 기본 설정으로 잡힌다.

 

DMA 인터럽트와 usart 인터럽트를 활성화 하고

 

보내는 함수 자체는 별로 차이가 없긴한데,

_DMA가 붙은 녀석을 이용해서 버퍼가 차면 비울만큼 전송하도록 명령을 보내고

HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, const uint8_t *pData, uint16_t Size, uint32_t Timeout)
HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, const uint8_t *pData, uint16_t Size)

 

TX 완료시에는 인터럽트가 뜨도록 해서 추가로 전송할지 정도만 구현하면 된다.

void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{
}

 

[링크  https://blog.naver.com/chandong83/222863872771]

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

stm32f wwdg iwdg 그리고 stop mode  (0) 2025.06.27
stm32 cubeide ioc gen  (0) 2025.06.18
stm32 pwm 주파수 계산  (0) 2025.06.05
stm32 timer로 gpio 토글하기  (0) 2025.06.05
stm32 pwm interrupt  (0) 2025.06.02
Posted by 구차니
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 구차니