embeded/Cortex-M3 STM2025. 7. 29. 17:51

X-CUBE-EEPROM 이 stm32f103 프로젝트에서 안보여서 찾아보는데

어...라... 왜 F만 빠져있냐 =_=

[링크 : https://www.st.com/resource/en/application_note/an4894-how-to-use-eeprom-emulation-on-stm32-mcus-stmicroelectronics.pdf]
[링크 : https://www.st.com/en/embedded-software/x-cube-eeprom.html]

[링크 : https://m.blog.naver.com/chcbaram/223153496808] << STM32G

 

STM32C0 series, STM32G0 series, STM32G4 series, STM32H5 series, STM32L4 series, STM32L4+ series, STM32L5 series, STM32U0 series, STM32U3 series, STM32U5 series, STM32WB series, STM32WL series

Reference documents
EEPROM emulation solutions and application notes are available for other STM32 series as listed below.
[1] Application note STM32F0 series EEPROM emulation in STM32F0xx microcontrollers (AN4061)
[2] Application note STM32F1 series EEPROM emulation in STM32F10x microcontrollers (AN2594)
[3] Application note STM32F2 series EEPROM emulation in STM32F2xx microcontrollers (AN3390)
[4] Application note STM32F3 series EEPROM emulation in STM32F30x/STM32F31x STM32F37x/STM32F38x
microcontrollers (AN4056)
[5] Application note STM32F4 series EEPROM emulation in STM32F40x/STM32F41x microcontrollers (AN3969)
[6] Application note Building wireless applications with STM32WB series microcontrollers (AN5289)
[7] Reference manual STM32H563/H573 and STM32H562 Arm®-based 32-bit MCUs (RM0481)







● eeprom.c: it contains C code for the following project routines:
EE_Init()
EE_Format()
EE_FindValidPage()
EE_VerifyPageFullWriteVariable()
EE_ReadVariable()
EE_PageTransfer()
EE_WriteVariable()
● eeprom.h: it contains the routine prototypes and some declarations

[링크 : https://www.st.com/resource/en/application_note/an2594-eeprom-emulation-in-stm32f10x-microcontrollers-stmicroelectronics.pdf]

 

가입 후 아래 링크에서 다운로드 받아야 사용할 수 있나 보다.

대충 봐서는 2개의 섹터를 오가면서 write 하는 듯. wear leveling 등은 구현이 안되어 있을 것 같네

[링크 : https://www.st.com/en/embedded-software/stsw-stm32010.html]

 

 

 

 

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

stm32 cpp  (0) 2025.08.08
stm32f103ret flash program / erase 테스트  (0) 2025.07.28
HAL_FLASH_Program  (0) 2025.07.21
stm32cubeide build analyzer  (0) 2025.07.21
stm32 wwdg, iwdg 차이  (0) 2025.06.30
Posted by 구차니
embeded/arduino(genuino)2025. 7. 29. 11:46

multiple slave 모드라는걸 지원해서, 1:6 까지 뿌릴수 있다고 한다.

 

[링크 : https://arduinomaker.tistory.com/38]

[링크 : https://blog.naver.com/mapes_khkim/221882273978]

 

Key Features
• Worldwide 2.4GHz ISM band operation
• Up to 2Mbps on air data rate
• Ultra low power operation
• 11.3mA TX at 0dBm output power
• 12.3mA RX at 2Mbps air data rate
• 900nA in power down
• 22µA in standby-I
• On chip voltage regulator
• 1.9 to 3.6V supply range
• Enhanced ShockBurst™
• Automatic packet handling
• Auto packet transaction handling
• 6 data pipe MultiCeiver™
• Air compatible with nRF2401A, 02, E1 and E2
• Low cost BOM
• ±60ppm 16MHz crystal
• 5V tolerant inputs
• Compact 20-pin 4x4mm QFN package


[링크 : https://cdn.sparkfun.com/datasheets/Wireless/Nordic/nRF24L01_Product_Specification_v2_0.pdf]

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

ads1115 복수 장치 읽기  (0) 2025.08.02
패시브 부저  (0) 2025.08.01
오랫만에 부품지름  (0) 2025.07.29
1.8인치 TFT LCD with SDcard  (0) 2024.10.18
아두이노 FFB 휠 소스코드  (0) 2024.10.11
Posted by 구차니
embeded/arduino(genuino)2025. 7. 29. 11:13

아니 쓰지도 못하고 재워두는거 왜 사는지 나도 이해가 안되지만 일단 지름 ㅋㅋㅋ

nRF24는 있어서 사려다가 패스

 

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

패시브 부저  (0) 2025.08.01
nRF24L01 복수 장치 통신  (0) 2025.07.29
1.8인치 TFT LCD with SDcard  (0) 2024.10.18
아두이노 FFB 휠 소스코드  (0) 2024.10.11
arducam esp8266 https post 예제  (0) 2024.01.31
Posted by 구차니
embeded/Cortex-M3 STM2025. 7. 28. 15:12

몇개 참조했는데 그냥 결국에는 맨땅에 헤딩해서 대충 구현.. -_ㅠ

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

 

1. HAL_Flash_Program() 호출 전에 해당 섹터는 HAL_FlashEx_Erase()를 불러서 지워져 있는 상태여야 함

STM32Cubeprogrammer로 보면 전부 0xFFFFFF 라서 그냥 바로 쓰면 되겠네? 싶어서

HAL_Flash_Unlock() 이후 바로  HAL_Flash_Program() 호출해서 쓰니 Hard Fault 발생 -_-

찾아봐도 별 도움되는건 없어서, 결국에는 지우고 새로 쓰니 문제 없이 되었는데

[링크 : https://community.st.com/t5/stm32-mcus-products/hal-flash-program-triggers-hardfault-exception/td-p/684669]

 

다시 안지우고 쓰려고 하면 아까처럼 hard fault는 안뜨고

HAL_Flash_Program() 의 리턴값이 HAL_ERROR(1)로 뜰 뿐 문제가 없다. 머지?

 

 

아래는 쓰는데 성공한 예제

 

2. 섹터 지우는건 빠른데, 쓰는건 느리다(word)

아래 코드에서 32MHz로 작동중인데,

Erase는 2msec 이내로 끝났고

Write는 2048 Byte, 1 섹터를 가득 채우는건데 65 msec 미만으로 소요되었다.

tick1 1
tick2 64

 

3. 16bit 32bit write 속도가 다르다.

함수 호출 횟수 차이인진 모르겠으나 WORD 에서 HALFWORD로 바꾸고 쓰기 횟수를 2배로 늘려주니

    ret = HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, addr, data);


무려(?) 3msec가 느려졌다.

tick1 1
tick2 67

 

3. HAL_FLASH_Unlock() / HAL_FLASH_Lock()

플래시를 unlock 하지 않고 erase / program 하면 실제로 써지거나 지워지지 않지만 HAL_OK로 리턴된다.

이게 머야 -_-

 

소스코드

void flash_test()
{
  HAL_StatusTypeDef ret;
  uint32_t addr = FLASH_BASE + 0x0007F800;
  int data = 0;

  HAL_FLASH_Unlock();

  FLASH_EraseInitTypeDef eraseDef;
eraseDef.TypeErase = FLASH_TYPEERASE_PAGES;
eraseDef.Banks = 1;
eraseDef.PageAddress = 0x807F800;
eraseDef.NbPages = 1;

  uint32_t ret_era = 0;
  uint32_t tick = HAL_GetTick();
  HAL_FLASHEx_Erase(&eraseDef, &ret_era);
  uint32_t tick2 = HAL_GetTick();

  printf("tick1 %d\r\n",tick2-tick);

  tick = HAL_GetTick();
  for(int idx = 0; idx < 512; idx++)
  {
    ret = HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, addr, data);
    if(ret != HAL_OK)
    {
      printf("ret[%x]\r\n", ret);
      break;
    }
    // else
    // {
    //   printf("%X [%X] ok\r\n", FLASH_BASE + addr * 4, data);
    // }

    addr += 4;
    data += 4;
  }
  tick2 = HAL_GetTick();
  printf("tick2 %d\r\n",tick2-tick);

  HAL_FLASH_Lock();
}

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

stm32 cpp  (0) 2025.08.08
stm32 eeprom emulation  (0) 2025.07.29
HAL_FLASH_Program  (0) 2025.07.21
stm32cubeide build analyzer  (0) 2025.07.21
stm32 wwdg, iwdg 차이  (0) 2025.06.30
Posted by 구차니
embeded/Cortex-M3 STM2025. 7. 21. 16:40

특이한 건 블럭단위가 아니라는 것과 program은 있어도 Erase나 Read 함수가 안보인다는 점.

// stm32f1xx_hal_flash.h
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);

HAL_StatusTypeDef HAL_FLASH_Unlock(void);
HAL_StatusTypeDef HAL_FLASH_Lock(void);
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);

// stm32f1xx_hal_flash_ex.h
HAL_StatusTypeDef  HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
HAL_StatusTypeDef  HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);

HAL_StatusTypeDef  HAL_FLASHEx_OBErase(void);
HAL_StatusTypeDef  HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
void               HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
uint32_t           HAL_FLASHEx_OBGetUserData(uint32_t DATAAdress);

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

[링크 : https://selpman.tistory.com/287]

 

음.. 플래시 영역은 0x0800 0000 으로 지정되어 있으니 거기서 부터 512KB (= 0x0008 0000)

인 0x0807 FFFF 까지 읽어보면 되려나

 

 

STM32F103RET 니까 아래 조건이려나

/* High Density */
#if (defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F103xE))
#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= FLASH_BASE) && (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x200U) ? \
                                           ((ADDRESS) <= FLASH_BANK1_END) :  (((*((uint16_t *)FLASH_SIZE_DATA_REGISTER)) == 0x180U) ? \
                                           ((ADDRESS) <= 0x0805FFFFU) :  ((ADDRESS) <= 0x0803FFFFU))))

#endif /* STM32F100xE || STM32F101xE || STM32F103xE */

 

그런데 STM32CubeProgrammer로 확인해보니

512KB 맞고 sector는 0에서 255까지 256개 * 2KB

 

Write Protect는 0에서 31 까지 총 32개.. 8개 섹터당 1개의 write protect 인가

 

 



 

 

2.4.2 Write protection
In high-density and connectivity line devices, from page 0 to page 61, write protection is implemented with a granularity of two pages at a time. The remaining memory block (from page 62 to page 255 in high-density devices, and from page 62 to page 127 in connectivity line devices) is write-protected at once.

0~61 까지는 2개씩 해서 총 31개 write protect로 상세하게 제어되고

62~255까지 퉁쳐서 1개,

합계 32개의 write protect로 제어된다.

[링크 : https://www.st.com/resource/en/programming_manual/pm0075-stm32f10xxx-flash-memory-microcontrollers-stmicroelectronics.pdf]

 

Depending on the selected boot mode, main Flash memory, system memory or SRAM is accessible as follows:
 Boot from main Flash memory: the main Flash memory is aliased in the boot memory space (0x0000 0000), but still accessible from its original memory space (0x800 0000). In other words, the Flash memory contents can be accessed starting from address 0x0000 0000 or 0x800 0000.
 Boot from system memory: the system memory is aliased in the boot memory space (0x0000 0000), but still accessible from its original memory space (0x1FFF B000 in connectivity line devices, 0x1FFF F000 in other devices).
 Boot from the embedded SRAM: SRAM is accessible only at address 0x2000 0000.

Embedded boot loader
The embedded boot loader is located in the System memory, programmed by ST during production. It is used to reprogram the Flash memory with one of the available serial interfaces:
 In low-, medium- and high-density devices the bootoader is activated through the USART1 interface.
 In XL-density devices the boot loader is activated through the following interfaces: USART1 or USART2 (remapped).
 In connectivity line devices the boot loader can be activated through one of the following interfaces: USART1, USART2 (remapped), CAN2 (remapped) or USB OTG FS in Device mode (DFU: device firmware upgrade).

[링크 : https://www.st.com/resource/en/reference_manual/rm0008-stm32f101xx-stm32f102xx-stm32f103xx-stm32f105xx-and-stm32f107xx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf]

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

stm32 eeprom emulation  (0) 2025.07.29
stm32f103ret flash program / erase 테스트  (0) 2025.07.28
stm32cubeide build analyzer  (0) 2025.07.21
stm32 wwdg, iwdg 차이  (0) 2025.06.30
stm32f wwdg iwdg 그리고 stop mode  (0) 2025.06.27
Posted by 구차니
embeded/Cortex-M3 STM2025. 7. 21. 15:35

크게 도움이 되는 기능은 아니지만 왜 안나오나 해서 찾아보니

windows - preference - STM32Cube - Build views settings 에서

on request 에서 auto로 바꾸어 주면 된다.

[링크 : https://eteo.tistory.com/846]

 

정책변경인진 모르겠지만 위 글을 참고하면 1.15.x~ 이후는 auto가 아니게 된 듯.

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

stm32f103ret flash program / erase 테스트  (0) 2025.07.28
HAL_FLASH_Program  (0) 2025.07.21
stm32 wwdg, iwdg 차이  (0) 2025.06.30
stm32f wwdg iwdg 그리고 stop mode  (0) 2025.06.27
stm32 cubeide ioc gen  (0) 2025.06.18
Posted by 구차니
embeded/전자회로2025. 7. 17. 11:06

웨비나 보다가 검색

보상도선을 쓰지 않으면 일반전선과 온도센서 접합점이 온도센서가 되어 오차가 발생 한다고

[링크 : https://m.blog.naver.com/jsrhim516/223414081150]

[ 링크 : https://setoo0922.tistory.com/353] 종류, 어댑터

 

열전대 용접기

[링크 : https://www.dhtc.co.kr/yc/shop/product.php?it_id=1568167478]

 

 

'embeded > 전자회로' 카테고리의 다른 글

buzzer - 액티브 패시브  (0) 2025.07.15
rheostat ?  (0) 2024.07.25
notch filter  (0) 2024.05.21
멀티미터 TR 테스트  (0) 2023.11.02
지름도착 - usb 인두기  (0) 2023.10.27
Posted by 구차니
embeded/전자회로2025. 7. 15. 16:46

indicator 혹은 active buzzer는 내부에 회로가 내장되어

전기만 공급되면 resonant frequency 로 소리를 발생시키는 부품이다.

transducer 라던가 passive buzzer가 pwm에 의해 주파수로 입력하면 원하는 소리가 나는 부품인듯.

 

[링크 : https://puiaudio.com/file/specs-AI-1223-TWT-3V-2-R.pdf]

'embeded > 전자회로' 카테고리의 다른 글

열전대 써모커플러  (0) 2025.07.17
rheostat ?  (0) 2024.07.25
notch filter  (0) 2024.05.21
멀티미터 TR 테스트  (0) 2023.11.02
지름도착 - usb 인두기  (0) 2023.10.27
Posted by 구차니
embeded/risc-v2025. 7. 8. 11:56

'embeded > risc-v' 카테고리의 다른 글

risc-v sv39  (0) 2023.11.18
milk-v duo(risc-v)  (0) 2023.11.18
부품 도착! + 주문 취소!  (0) 2023.11.02
오늘의 지름  (0) 2023.11.01
risc-v 저가보드 / sipeed maix amigo  (0) 2023.11.01
Posted by 구차니
embeded/esp322025. 7. 8. 11:07

ESP32 / ESP32-S 만 xtensa 계열이고, 나머지는 RISC-V 계열이다.

특이하게 C5/C6/C61 에서는 802.11ax 까지 지원하고, C5만 802.11ac를 지원한다.

 

  ESP32-P4 ESP32-S3 ESP32-S2 ESP32-C5 ESP32-C6 ESP32-C61 ESP32-C3 ESP32-C2 ESP32-H4 ESP32-H2 ESP32
wifi   bgn bgn bgn/ac/ax bgn/ax bgn/ax bgn bgn     bgn
BLE   5.0   5.3 5.3 5.0 5.0 5.0 5.4 5.0 4.2/classic
arch RISC-V Xtensa Xtensa RISC-V RISC-V RISC-V RISC-V RISC-V RISC-V RISC-V Xtensa
core dual dual single single single single single single Dual Single Single/Dual
clock(MHZ) 400 240 240 240 160 160 160 120 96 96 240

[링크 https://products.espressif.com/static/Espressif%20SoC%20Product%20Portfolio.pdf]

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

esp32devkitc v4  (0) 2025.01.06
esp32cam sdio wifi  (0) 2024.09.11
esp32 wifi/bt on linux  (0) 2024.08.13
esp32 at 소스 빌드(윈도우)  (0) 2023.12.19
esp32 at source 빌드(리눅스)  (0) 2023.12.19
Posted by 구차니