| 数据搜索系统,热门电子元器件搜索 |
|
STM8AL3L89 数据表(PDF) 9 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
STM8AL3L89 数据表(HTML) 9 Page - STMicroelectronics |
|
9 / 18 page ![]() DocID17922 Rev 6 9/18 STM8AL3xxx STM8L052R8 STM8L1xxx6/8 Silicon limitations 17 Workaround 3 This workaround can be used if block erase cannot be replaced by block programming. In this workaround, DMA is used to transfer data to the EEPROM instead of the core. All other DMA transfers are delayed once the core is stalled due to data transfer to memory controller. /* start of the workaround in user code, using FW Library */ #ifdef USE_EVENT_MODE DMA1_Channel3->CCR= DMA_CCR_MEM | DMA_CCR_IDM | DMA_CCR_TCIE; /* Config DMA Chn3 Mem, incr, disable, interrupt) */ #else DMA1_Channel3->CCR= DMA_CCR_MEM | DMA_CCR_IDM; /* Config DMA Chn3 (Mem, incr,disable) */ #endif DMA1_Channel3->CM0ARH= (uint8_t)0; /* Source address */ DMA1_Channel3->CM0ARL= (uint8_t)0; DMA1_Channel3->CPARH= (uint8_t)(addr_begin >> 8); /* Destination address */ DMA1_Channel3->CPARL= (uint8_t)(addr_begin); DMA1_Channel3->CNBTR= 2; /* Number of data to be transferred */ DMA1_Channel3->CSPR= 8; /* Low priority, 16 bit mode */ DMA1_Channel3->CSPR &= ~DMA_CSPR_TCIF;/* Clear TCIF */ DMA1->GCSR|= 1; /* Global DMA enable */ #ifdef USE_EVENT_MODE WFE->CR3 = WFE_CR3_DMA1CH23_EV; /* Enable event generation on DMA */ #endif FLASH->DUKR = 0xAE; /* Unprotect data memory */ FLASH->DUKR = 0x56; while((FLASH->IAPSR & FLASH_IAPSR_DUL) == 0) {} /* Polling DUL */ FLASH_Block_Load(); /* end of the workaround in user code */ /* following routine has to be placed in the RAM */ void FLASH_Block_Load(){ __asm("sim\n"); /* Disable interrupts */ FLASH->CR2 |= FLASH_CR2_ERASE; /* Enable erase block mode */ DMA1_Channel3->CCR|= DMA_CCR_CE; /* Enable DMA MEM transfer */ #ifdef USE_EVENT_MODE __asm("wfe"); /* Wait for end of DMA operation */ #else while((DMA1_Channel3->CSPR & DMA_CSPR_TCIF) == 0) {} /* Polling for end of DMA operation */ #endif __asm("rim\n"); /* Enable interrupts */ } |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |