embeded/Cortex-M7 STM2024. 9. 4. 15:04

STM32에 프로그램 작성을 위해

CubeIDE 에서 DEBUG를 넣지 않으면 디버깅, 프로그래밍 잘 하다가 어느순간

"no MCU device found" 에러가 발생하며 CPU가 먹통이 되는 경우가 갑자기 발생

 

AVR 인공호흡(?) 처럼 검색해보니

boot0 핀을 이용해서 다른 번지로 부팅을 하게 하면, JTAG이나 SWD이 사용하지 않도록 설정된 프로그램이 실행되지 않아

정상적으로 JTAG/SWD로 접근할 수 있게 된다.

[링크 : https://progdev.tistory.com/16]

 

PB3(SWO)가 영향을 주는 편이라고

[링크 : https://blog.naver.com/crucian2k3/221533654464]

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

DEBUG_JTRST  (0) 2024.09.06
STM32H757 전원 설정  (0) 2024.09.04
STM32CubeIDE alt func  (0) 2024.09.03
stm32h757i-eval 데모 펌웨어 굽기  (0) 2024.08.07
stm32cubeide 빌드할 소스 추가하기  (0) 2024.08.01
Posted by 구차니
embeded/Cortex-M7 STM2024. 9. 3. 19:46

cubeIDE 에서 설정할 때 기본으로 잡혀있는 핀이 있는데

그게 아닌 다른 것을 설정하려면 alternative function 으로 지정해서 pin mux 설정이 되어야 한다.

CubeIDE 에서는 ioc 파일 열어 gui 에서 대충~ 핀 설정해주고 기능 enable 시키면 알아서 매핑되어 생성된다.

[링크 : https://m.blog.naver.com/harkjael/222315747541]

 

해당 alt func는

_AF_ 라는 접두를 붙여서 msp 소스에 구현된다.

  else if(huart->Instance==USART1)
  {
  /* USER CODE BEGIN USART1_MspInit 0 */

  /* USER CODE END USART1_MspInit 0 */
    /* Peripheral clock enable */
    __HAL_RCC_USART1_CLK_ENABLE();

    __HAL_RCC_GPIOB_CLK_ENABLE();
    /**USART1 GPIO Configuration
    PB14     ------> USART1_TX
    PB15     ------> USART1_RX
    */
    GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
    GPIO_InitStruct.Alternate = GPIO_AF4_USART1;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

  /* USER CODE BEGIN USART1_MspInit 1 */

  /* USER CODE END USART1_MspInit 1 */
  }

...

    GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_5|GPIO_PIN_6;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
    GPIO_InitStruct.Alternate = GPIO_AF5_SPI4;
    HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

 

stm32h7xx_hal_gpio_ex.h

#define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping   */
#define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2 Alternate Function mapping   */
#define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3 Alternate Function mapping   */
#define GPIO_AF5_SPI4          ((uint8_t)0x05)  /* SPI4 Alternate Function mapping   */
#define GPIO_AF5_SPI5          ((uint8_t)0x05)  /* SPI5 Alternate Function mapping   */
#define GPIO_AF5_SPI6          ((uint8_t)0x05)  /* SPI6 Alternate Function mapping   */
#define GPIO_AF5_CEC           ((uint8_t)0x05)  /* CEC  Alternate Function mapping   */

#define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping   */
#define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping   */
#define GPIO_AF4_I2C3          ((uint8_t)0x04)  /* I2C3 Alternate Function mapping   */
#define GPIO_AF4_I2C4          ((uint8_t)0x04)  /* I2C4 Alternate Function mapping   */
#if defined(I2C5)
#define GPIO_AF4_I2C5          ((uint8_t)0x04)  /* I2C5 Alternate Function mapping   */
#endif /* I2C5*/
#define GPIO_AF4_TIM15         ((uint8_t)0x04)  /* TIM15 Alternate Function mapping  */
#define GPIO_AF4_CEC           ((uint8_t)0x04)  /* CEC Alternate Function mapping    */
#define GPIO_AF4_LPTIM2        ((uint8_t)0x04)  /* LPTIM2 Alternate Function mapping */
#define GPIO_AF4_USART1        ((uint8_t)0x04)  /* USART1 Alternate Function mapping */
#if defined(USART10)
#define GPIO_AF4_USART10       ((uint8_t)0x04)  /* USART10 Alternate Function mapping : available on STM32H72xxx/STM32H73xxx */
#endif /*USART10*/
#define GPIO_AF4_DFSDM1        ((uint8_t)0x04)  /* DFSDM  Alternate Function mapping */
#if defined(DFSDM2_BASE)
#define GPIO_AF4_DFSDM2        ((uint8_t)0x04)  /* DFSDM2 Alternate Function mapping */
#endif /* DFSDM2_BASE */
#define GPIO_AF4_DCMI          ((uint8_t)0x04)   /* DCMI Alternate Function mapping : available on STM32H7A3xxx/STM32H7B3xxx/STM32H7B0xxx and STM32H72xxx/STM32H73xxx */
#if defined(PSSI)
#define GPIO_AF4_PSSI          ((uint8_t)0x04)  /* PSSI Alternate Function mapping   */
#endif /* PSSI */
#if defined(OCTOSPIM)
#define GPIO_AF4_OCTOSPIM_P1   ((uint8_t)0x04)  /* OCTOSPI Manager Port 1 Alternate Function mapping  : available on STM32H72xxx/STM32H73xxx */
#endif /* OCTOSPIM */


stm32h7xx_hal_msp.c 에서 핀 설정이 변경되는데, 파일 이름의 msp는 mcu 지원 패키지의 약자랜다.

msp - mcu support package

[링크 : https://community.st.com/t5/stm32cubemx-mcus/hal-peripheral-msp-init-why-does-stm32cubeide-generated-code-not/td-p/219207]

 

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

STM32H757 전원 설정  (0) 2024.09.04
STM32 / no MCU device found  (0) 2024.09.04
stm32h757i-eval 데모 펌웨어 굽기  (0) 2024.08.07
stm32cubeide 빌드할 소스 추가하기  (0) 2024.08.01
STM32H75I-EVAL  (0) 2024.08.01
Posted by 구차니
embeded/Cortex-M7 STM2024. 8. 7. 15:21

파일을 올리기 전에

 

EL 이라고 써있는 External Loaders를 선택해서

 

stm32h747로 검색하면 나오는 보드가 있는데 해당 보드를 선택후 플래시를 진행하면 정상적으로 구워진다.

 

플래시를 활성화할수 있는 코드를 external loader에서 실행해주는 것 같고

로더가 먼저 실행된 후 내부 플래시와 외부 NOR flash에 구워지는 것으로 보인다.

757(보안 모듈 있음) 747(보안모듈 없음) 차이므로 보드가 다르다고 하더라도 문제는 없을듯 하다.

 

[링크 : https://community.st.com/t5/stm32-mcus-products/nor-flash-memory-in-stm32h747i-eval-board/td-p/629797]

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

STM32 / no MCU device found  (0) 2024.09.04
STM32CubeIDE alt func  (0) 2024.09.03
stm32cubeide 빌드할 소스 추가하기  (0) 2024.08.01
STM32H75I-EVAL  (0) 2024.08.01
stm32cubeide 펌웨어 업데이트 이후 자동 재시작  (2) 2024.07.25
Posted by 구차니
embeded/Cortex-M7 STM2024. 8. 1. 15:23

core 쪽은 추가하면 바로 빌드되는데

별도의 디렉토리를 추가하고 소스를 넣으면 빌드가 자동으로 안된다.

 

includes 탭은 include 파일/디렉토리를 추가하고

 

Source Location 에는 소스 파일/디렉토리를 추가하면 된다.

[링크 : https://mokhwasomssi.tistory.com/198]

 

드디어 에러가 발생한다아!!!! 만세!!

Posted by 구차니
embeded/Cortex-M7 STM2024. 8. 1. 10:49

한번 새로 프로젝트 만들려고 해보는데

어...라... STM32H7로 검색하니 750까지만 공개(?)되어 있고, 757은 안나온다.

 

그래서 홈페이지 가서 뒤져보니 데모용 바이너리는 존재한다. 이거 소스는 못 받나?

[링크 : https://www.st.com/en/evaluation-tools/stm32h757i-eval.html#tools-software]

Posted by 구차니
embeded/Cortex-M7 STM2024. 7. 25. 13:51

자동 재시작이 안되서 이상하다 싶어 보는데

Reset behavior에 "Connect under reset"이 되어있으면 펌웨어 업데이트 이후 리셋을 눌러줘야 재기동하고

"Software system reset"을 하면 펌웨어 업데이트 이후 자동으로 재시작 된다.

 

Halt all cores가 체크 가능한건 두 개 뿐이네..

Posted by 구차니
embeded/Cortex-M7 STM2024. 7. 24. 16:18

아무생각없이 무지성으로 clean 하면 매번 빌드되서 짜증났는데

proejct 쪽 메뉴에서 preference 봐도 없길래

clean 메뉴를 다시 보니 가장 아래에

"Start a build immediately"에 체크가 되어있다.

아니.. clean 한다고 왜 빌드 바로 하라는 옵션이 있냐구요.. -_-

 

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

STM32H75I-EVAL  (0) 2024.08.01
stm32cubeide 펌웨어 업데이트 이후 자동 재시작  (2) 2024.07.25
우분투에서 stm32cubeide 삭제  (0) 2024.07.24
STM32H7 디버깅 설정(cubeIDE)  (0) 2024.07.22
STM32H750 operation mode  (0) 2024.07.22
Posted by 구차니
embeded/Cortex-M7 STM2024. 7. 24. 16:10

버전을 넣어서 삭제하면 끝

$ sudo apt purge segger-jlink-udev-rules st-stlink-server st-stlink-udev-rules st-stm32cubeide-1.5.0

[링크 : https://askubuntu.com/questions/1444347/uninstall-stm32cubeide]

Posted by 구차니
embeded/Cortex-M7 STM2024. 7. 22. 18:15

Halt all cores 를 체크해서

Cortex-M7을 멈추면 Cortex-M4 도 같이 멈추고

 

Cortex-M4 에는 Halt 옵션이 없으니 M7을 멈출수 없어서 M4만 멈췄나 보다.

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

Posted by 구차니
embeded/Cortex-M7 STM2024. 7. 22. 17:13

소스를 뒤져보면서 메뉴얼 찾아보는 중

 

stm32h7xx_hal_pwr_ex.c 파일에 보면 D3Domain 이라고 PWR_CPUCR_RUN_D3 라고

d3 도메인의 cpu (cortex-m4)를 살리는 녀석으로 보인다.

void HAL_PWREx_ConfigD3Domain (uint32_t D3State)
{
  /* Check the parameter */
  assert_param (IS_D3_STATE (D3State));

  /* Keep D3/SRD in run mode */
  MODIFY_REG (PWR->CPUCR, PWR_CPUCR_RUN_D3, D3State);
}

 

/********************  Bit definition for PWR_CPUCR register  *****************/
#define PWR_CPUCR_RUN_D3_Pos           (11U)
#define PWR_CPUCR_RUN_D3_Msk           (0x1UL << PWR_CPUCR_RUN_D3_Pos)         /*!< 0x00000800 */
#define PWR_CPUCR_RUN_D3               PWR_CPUCR_RUN_D3_Msk                    /*!< Keep system D3 domain in RUN mode regardless of the CPU sub-systems modes */


/********************  Bit definition for PWR_CPU2CR register  ****************/
#define PWR_CPU2CR_RUN_D3_Pos          (11U)
#define PWR_CPU2CR_RUN_D3_Msk          (0x1UL << PWR_CPU2CR_RUN_D3_Pos)        /*!< 0x00000800 */
#define PWR_CPU2CR_RUN_D3              PWR_CPU2CR_RUN_D3_Msk                   /*!< Keep system D3 domain in RUN mode regardless of the CPU sub-systems modes */

 

stm32h757xi.pdf 데이터 시트 31page

어.. D2 domain에 Cortex-M4 였네..

 

rm0399-stm32h745755-and-stm32h747757-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

7.6.1 Operating modes
Several system operating modes are available to tune the system according to the
performance required, i.e. when the CPU(s) do not need to execute code and are waiting for
an external event. It is up to the user to select the operating mode that gives the best
compromise between low power consumption, short startup time and available wakeup
sources.
The operating modes allow controlling the clock distribution to the different system blocks
and powering them. The system operating mode is driven by CPU1 subsystem, CPU2
subsystem and system D3 autonomous wakeup. A CPU subsystem can include multiple
domains depending on its peripheral allocation (see Section 9.5.11: Peripheral clock gating
control).
The following operating modes are available for the different system blocks (see Table 34):

CPU subsystem modes:

CRun
CPU and CPU subsystem peripheral allocated via RCC PERxEN bits are clocked.

CSleep:
The CPU clocks is stalled and the CPU subsystem allocated peripheral(s) clock
operate according to RCC PERxLPEN.

CStop:
CPU and CPU subsystem peripheral clocks are stalled.

D1 domain and D2 domain modes:

DRun
The domain bus matrix is clocked:
- The domain CPU subsystem(a) is in CRun or CSleep mode,
or
- the other domain CPU subsystem(a) having an allocated peripheral in the domain
is in CRun or CSleep mode.

DStop
The domain bus matrix clock is stalled:
- The domain CPU subsystem is in CStop mode
and
- The other domain CPU subsystem has no peripheral allocated in the domain.
or the other domain CPU subsystem having an allocated peripheral in the domain
is also in CStop mode
and
- At least one PDDS_Dn(b) bit for the domain select DStop.

DStandby
The domain is powered down:
- The domain CPU subsystem is in CStop mode
and
- The other domain CPU subsystem has no peripheral allocated in the domain
or the other domain CPU subsystem having an allocated peripheral in the domain
is also in CStop mode
and
- All PDDS_Dn(b) bits for the domain select DStandby mode.

System /D3 domain modes

Run/Run*
The system clock and D3 domain bus matrix clock are running:
- A CPU subsystem is in CRun or CSleep mode
or
- A wakeup signal is active. (i.e. System D3 autonomous mode)
The Run* mode is entered after a POR reset and a wakeup from Standby. In Run*
mode, the performance is limited and the system supply configuration shall be
programmed in PWR control register 3 (PWR_CR3). The system enters Run
mode only when the ACTVOSRDY bit in PWR control status register 1
(PWR_CSR1) is set to 1.

Stop
The system clock and D3 domain bus matrix clock is stalled:
- both CPU subsystems are in CStop mode.
and
- all wakeup signals are inactive.
and
- At least one PDDS_Dn(b) bit for any domain select Stop mode.

Standby
The system is powered down:
- both CPU subsystems are in CStop mode
and
- all wakeup signals are inactive.
and
- All PDDS_Dn(b) bits for all domains select Standby mode.
In Run mode, power consumption can be reduced by one of the following means:
•Lowering the system performance by slowing down the system clocks and reducing the
VCORE supply level through VOS voltage scaling bits.
•Gating the clocks to the APBx and AHBx peripherals when they are not used, through
PERxEN bits.

a. The domain CPU subsystem, for example CPU1 subsystem for D1 domain.
a. The other domain CPU subsystem, for example CPU1 subsystem for D2 domain.

 

9 Reset and Clock Control (RCC)
The RCC block manages the clock and reset generation for the whole microcontroller, which embeds two CPUs: an Arm® Cortex®-M7 and an Arm® Cortex®-M4, called CPU1 and CPU2, respectively.
The RCC block is located in the D3 domain (refer to Section 7: Power control (PWR) for a detailed description).
The operating modes this section refers to are defined in Section 7.6.1: Operating modes of the PWR block.

 

cpu1 power 용

 

cpu2 power 용. 서로 접근하면 되나?

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

우분투에서 stm32cubeide 삭제  (0) 2024.07.24
STM32H7 디버깅 설정(cubeIDE)  (0) 2024.07.22
STM32 MPU(Memory Protection Unit)  (2) 2024.07.22
STM32 HSEM (Hardware SEMaphore)  (0) 2024.07.22
STM32H757 User configuration  (0) 2024.07.22
Posted by 구차니