블로그 이미지
안녕1999

카테고리

전체 (3067)
자바스크립트 (20)
안드로이드 (14)
WebGL (4)
변비 (17)
정치,경제 (35)
C언어,ARM (162)
컴퓨터(PC, Note Book, 윈.. (41)
전자회로, PCB (27)
유머,안웃긴,GIF,동영상 (118)
국부론60 (71)
모듈(PCB) (3)
건강 (2)
FreeCAD (25)
PADS (43)
퇴직,퇴사,구직,취업 활동 (3)
C# (86)
엑셀 (8)
워드 (0)
LabView (6)
레고 (30)
FPGA (0)
Total
Today
Yesterday

달력

« » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

공지사항

최근에 올라온 글

Posted by 안녕1999
, |

I2S는 보통 16~48kHz x 16bit x 2CH의 고속 데이터신호이다.

I2S를 지원하는 mcu가 있긴하지만, 1,2개 포트만 지원하고, 가격도 높은 편이다.

I2S가 2개이살 필요할때, SPI등의 다른 조건까지 만족하는 mcu를 찾는것은 쉽지 않다.


인터넷상에서는 SPI포트로 구현하고 있다.

그러나, SPI포트도 부족한 상황이라, 사용하기 쉽지 않다.


방법1) GPIO포트로 i2S구현이 가능할까?


48MHz mcu인 경우, 48kHz, 16비트 2채널 오디오를 처리하려면,

48000kHz/(48kHz*32bit)=31.25클럭

즉, 1비트씩 on/off할때, 31클럭(명령)을 수행할 수 있다.

인터럽트를 사용하게되면, 기본 10~50클럭정도는 필요하다.

31클럭이라면, I2S가 요구하는 비트클럭을 맞추기 어렵다.


방법2) 쉬프트레지스터 IC 74hc165(병렬입력-직렬출력), 74hc595(직렬입력-병렬출력)

mcu에서 8비트씩 한번에 입/출력하면, 

48000kHz/(48kHz*32bit/8)=375

충분히 제어가 가능하다.

단, I2S 1포트당 2개의 ic가 필요하고, 비용은 개당 약 200원씩, 합계 약 400원이다. ADC/DAC면 2배.

PCB공간도 필요하다.


결론 : 쉽지 않다.

Posted by 안녕1999
, |

In-Application Programming (IAP)


부트로더 개념.

PC에서 프로그램을 다운로드 및 실행할 수 있다.



벡터 테이블이 2개인것에 주목.

jump (unconditional branching)명령으로 2번째 프로그램(윗쪽, 사용자 프로그램)을 실행




AN3965 

STM32F40x/STM32F41x in-application programming using the USART


AN4657

STM32 in-application programming (IAP) using the USART 


RM0090  Reference manual

STM32F405/415, STM32F407/417, STM32F427/437 and STM32F429/439 advanced ARM®-based 32-bit MCUs


RM0090






STM32 - FLASH write




검색결과

IAP (In-Application Programming), internal flash erase/write | mbed

https://developer.mbed.org/.../iap-in-application-programming-in...
이 페이지 번역하기
2015. 7. 3. - Sample code for how to erase/write LPC1768, LPC11U24, LPC1114, LPC812 and LPC824 internal flash memory. This program uses IAP call ...

In-Application Programming (IAP) Code Example | www.LPCware.com

https://www.lpcware.com/.../application-programming-iap-code-e...
이 페이지 번역하기
2012. 9. 27. - For those in need of IAP demo code / example code, here's simple code ... Command codes for IAP ... Prepare flash sector(s) for erase / writing

problem with IAP-based internal flash programming. | www.LPCware ...

https://www.lpcware.com/.../problem-iap-based-internal-flash-pro...
이 페이지 번역하기
2013. 6. 26. - 댓글 3 - ‎작성자 2
I'm working with "SimpleCortex" board, and have been stumbling on an issue with flashprogramming using the IAP functions.

IAP flash programming - put program to RAM - Keil

www.keil.com/forum/.../iap-flash-programming-put-program-to-...
이 페이지 번역하기
2010. 11. 9. - 댓글 10 - ‎작성자 3
I have developed C code for programming flash using IAP, and I cameto point when I can successful programming sectors 1 to 17 of ...
게시물 5개
2013년 7월 7일
게시물 5개
2013년 1월 7일
게시물 4개
2007년 11월 27일

[PDF]AN3965 - STMicroelectronics

www.st.com/resource/en/application_note/dm00036049.pdf
이 페이지 번역하기
2011. 10. 12. - The STM32F4xx microcontroller can run user-specific firmware to perform IAP of the microcontroller-embedded Flash memory. This feature ...

[PDF]STM32 in-application programming (IAP) using the USART

www.st.com/resource/en/application_note/dm00161366.pdf
이 페이지 번역하기
2015. 4. 27. - An STM32 microcontroller can run user-specific firmware to perform IAP of the Flashmemory embedded in the microcontroller. This feature can ...

flash programming problem - Simplecortex

www.brc-electronics.nl/.../565-flash-programming-problem?...0
이 페이지 번역하기
2013. 6. 25. - I'm trying to use the IAP (in-application-programming) commands to write to the internal flash on the LPC1769. Generally speaking things seem ...

rfLPC: Flash memory In-Application Programming (IAP) - GitHub Pages

hauspie.github.io/rflpc/doc/group__iap.html
이 페이지 번역하기
Flash memory sector-address mapping. More... int, rflpc_iap_get_sector_from_address (const void *address). Flash memory address-sector mapping. More.

microcontroller - Writing to and reading data from Flash using IAP ...

electronics.stackexchange.com/.../writing-to-and-reading-data-fro...
이 페이지 번역하기
2015. 5. 6. - Here you can see functions I'm using to store data into Flash, but I'm getting data erased after power reset, so it's still in RAM not in Flash.

[PDF]AN10835 LPC2000 secondary bootloader for code update using IAP

www.nxp.com/documents/application_note/AN10835.pdf
이 페이지 번역하기
2009. 5. 26. - LPC2000, Secondary bootloader, IAP, Code update. Abstract ... chip flash via UART with 1K XMODEM protocol, SD/MMC with file system ...


Posted by 안녕1999
, |
stm32f2xx_flash.h등의 파일을 include해야한다.

FLASH는 쓰기위해서는 먼져 삭제해야한다.

FLASH_Status FLASH_EraseSector(uint32_t FLASH_Sector, uint8_t VoltageRange);

FLASH_Status FLASH_EraseAllSectors(uint8_t VoltageRange); 



쓰기함수는 3가지가 있다. 버퍼쓰기함수는 만들어야할듯.

FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data);

FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);

FLASH_Status FLASH_ProgramByte(uint32_t Address, uint8_t Data); 

지우기는 섹터단위이고, 쓰기는 주소이다. 각 섹터의 주소가 어디인지 알아야한다.



현재 상태나, 이전 쓰기,지우기등의 동작 결과 확인함수

FLASH_Status FLASH_GetStatus(void); 

FLASH_Status FLASH_WaitForLastOperation(void);


리턴값은 아래와 같다.

typedef enum

  FLASH_BUSY = 1,

  FLASH_ERROR_PGS,

  FLASH_ERROR_PGP,

  FLASH_ERROR_PGA,

  FLASH_ERROR_WRP,

  FLASH_ERROR_PROGRAM,

  FLASH_ERROR_OPERATION,

  FLASH_COMPLETE

}FLASH_Status; 


전압이 너무 낮으면, 사용할 수 없다. 현재 사용하는 전압을 설정해준다.

"꼭 해야되?"

=>CPU 전압에 따라 동작할 수 도 있고, 안될 수 도 있다.

#define VoltageRange_1        ((uint8_t)0x00)  /*!< Device operating range: 1.8V to 2.1V */

#define VoltageRange_2        ((uint8_t)0x01)  /*!<Device operating range: 2.1V to 2.7V */

#define VoltageRange_3        ((uint8_t)0x02)  /*!<Device operating range: 2.7V to 3.6V */

#define VoltageRange_4        ((uint8_t)0x03)  /*!<Device operating range: 2.7V to 3.6V + External Vpp */ 


#define FLASH_Sector_0     ((uint16_t)0x0000) /*!< Sector Number 0 */

#define FLASH_Sector_1     ((uint16_t)0x0008) /*!< Sector Number 1 */

#define FLASH_Sector_2     ((uint16_t)0x0010) /*!< Sector Number 2 */

#define FLASH_Sector_3     ((uint16_t)0x0018) /*!< Sector Number 3 */

#define FLASH_Sector_4     ((uint16_t)0x0020) /*!< Sector Number 4 */

#define FLASH_Sector_5     ((uint16_t)0x0028) /*!< Sector Number 5 */

#define FLASH_Sector_6     ((uint16_t)0x0030) /*!< Sector Number 6 */

#define FLASH_Sector_7     ((uint16_t)0x0038) /*!< Sector Number 7 */

#define FLASH_Sector_8     ((uint16_t)0x0040) /*!< Sector Number 8 */

#define FLASH_Sector_9     ((uint16_t)0x0048) /*!< Sector Number 9 */

#define FLASH_Sector_10    ((uint16_t)0x0050) /*!< Sector Number 10 */

#define FLASH_Sector_11    ((uint16_t)0x0058) /*!< Sector Number 11 */ 


내장된 플래시메모리는, 코드가 실행중에는 삭제/쓰기가 안된다.(읽기는 됨)

그래서 RAM에 쓰기관련 코드를 올려서, RAM에서 실행하면서, FLASH에 쓰면, 모든 영역의 FLASH에 쓰기를 할 수 있다.


FLASH가 섹터별로 나뉜 이유는, 사용하지 않는 섹터는 쓰기가 가능하다.

따라서, FLASH 사이즈가 256k이고, 프로그램 코드가 64k인 경우, 64k를 제외한 나머지 영역에 존재하는 섹터는 데이터용으로 쓰기가 가능하다.


IAP와 같은 부트로더 제작도 가능.



In-Application Programming (IAP)



RM0090

위 표는 "STMicroelectronics flash loader.exe"화면에 나온다.






FLASH_Latency_2, VoltageRange_1 정도로 설정하면, 동작함.

프로그램코드도 지워진다.(정지함)


FLASH는 EEPROM과 달리, 한번 기록되면, 다시쓰기위해 Erase해주어야한다.

또한, EEPROM처럼 수시로 업데이트가 불가능하다.

한번 저장하면, 오래 사용하는 데이터를 저장하기에 적당한 메모리이다.


FLASH_Unlock();

쓰기()

FLASH_Lock();

Posted by 안녕1999
, |

system-reset을 구현하기위해, 와치독타이머를 사용하려고한다.

그러나, 기존 와치독 타이머는 너무 오래걸려서, 중지하고, 시간을 짧게 조절하려고한다.


=> IWDG는 한번 시작하면, 중지할 수 없다고 합니다.(변경 불가인듯)


적당한 시간설정해서 사용해야할듯.

Posted by 안녕1999
, |

최근에 달린 댓글

글 보관함