cancel
Showing results for 
Search instead for 
Did you mean: 

Erase or write flash page at BANK2 on the STM32G0B1 with STM32_Programmer_CLI does not work!

AlexRabro
Associate

Hello,
I have spent several days trying to figure out how to use STM32_Programmer_CLI.exe to delete and describe certain pages on BANK2 but so far without success.

If DUAL_BANK is 0 (0: 256Kbytes/512Kbytes single-bank flash memory, contiguous addresses in bank 1) and then adjust the page number accordingly in the CLS commands, then everything works without problems.
The CLI command (to erase and write on Page 126 at BANK2) is: -c port=COM4 br=115200 p=EVEN db=8 sb=1 -vb 1 -ob displ -log " + exePathDirectory + "\\tracePar.log -e 126 --skiperase -d " + pathBinFile + " 0x0803F000 --start 0x08000000"

 

if DUAL_BANK is 1 (default setting), then the CLI command is like this: "-c port=COM4 br=115200 p=EVEN db=8 sb=1 -vb 1 -ob displ -log " + exePathDirectory + "\\tracePar.log -e 65342 -d " + pathBinFile + " 0x0803F000 --start 0x08000000";

I have to say that before these commands are executed, some functions in the firmware are executed and then the bootloader is started. For example this function:

 

void ServiceBootJump(void)
{
void (*SysMemBootJump)(void);
uint8_t i=0;
volatile uint32_t addr = 0x1FFF0000;
(void) HAL_RCC_DeInit();
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
(void) HAL_UART_DeInit(handleuart);
 
// Clear all interrupt bits
for (i = 0; i < sizeof(NVIC->ICER) / sizeof(NVIC->ICER[0]); i++)
{
  NVIC->ICER[i] = 0xFFFFFFFF;
  NVIC->ICPR[i] = 0xFFFFFFFF; 
}
 
// REMAP
SYSCFG->CFGR1 = 0x01;
__HAL_RCC_SYSCFG_CLK_ENABLE();
 
SCB->VTOR=0; 
 
SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
__set_MSP(*(uint32_t *)addr);
 
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
 
SysMemBootJump(); // Start BOOTLOADER
}

Since the setting (DUAL_BANK) is set to 1 by default, I want to be able to delete and write to certain pages in BANK2.

Can someone help me how to solve this problem?

Set BKER to 1 did not help either: SET_BIT(FLASH->CR, FLASH_CR_BKER);

 

( Bit 13 BKER: Bank selection for erase operation
This bit selects the target of erase operation (Bank 1 or Bank 2).
0: Bank 1
1: Bank 2
The bit has no effect on the single-bank devices.)
 
Many thanks
2 REPLIES 2
Maryem
ST Employee

Hello @AlexRabro,

 

Thank you for reporting this issue. We have identified it as a known problem that is currently being tracked. As a workaround, please try erasing BANK2 sector by sector before downloading the file.

Internal ticket number: 192989 (This is an internal tracking number and is not accessible or usable by customers).

We apologize for any inconvenience and appreciate your understanding. I will keep you updated on any progress.

 

Maryem.


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hello Maryem,

unfortunately I could not solve the problem. I think that if you delete only one page or sector from BANK2 and then describe it, it works, but as soon as you want to delete and describe more than one page in BANK2, it no longer works.

I have now decided to set the bit DUAL_BANK to 0 so that I can delete and write to the pages in BANK2.