AnsweredAssumed Answered

[stm32l053r8]EEPROM HAL Driver Lib problem

Question asked by le_dinh.trung on Mar 26, 2015
Latest reply on Mar 26, 2015 by Clive One
I try this simple code to get used to EEPROM HAL drivers library, but when i try to download the code to the board and start debugging with Keil, it appears "cannot access target. Shut down debugging session" and then i could not  download the code to the board again as it says "Internal Command Error" (per my understanding it happens only when some pins relating debugging are changed ). I try full erase chip with with reset button and try which syntax cause that problem, and I found of it is due to this command 
HAL_FLASHEx_DATAEEPROM_Program(TYPEPROGRAM_HALFWORD, add, data);

Can anyone help me understand this problem or it is a bug from library ?

THank you very much 

volatile uint32_t data=35,a=0;<
br>volatile uint32_t add = 0x08080000 ;<br>/* USER CODE END PV */<br><br><br>/* Private function prototypes -----------------------------------------------*/<br>void SystemClock_Config(void);<br><br><br>/* USER CODE BEGIN PFP */<br><br><br>/* USER CODE END PFP */<br><br><br>/* USER CODE BEGIN 0 */<br><br><br>/* USER CODE END 0 */<br><br><br>int main(void)<br>{<br><br><br>  /* USER CODE BEGIN 1 */<br><br><br>  /* USER CODE END 1 */<br><br><br>  /* MCU Configuration----------------------------------------------------------*/<br><br><br>  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */<br>  HAL_Init();<br><br><br>  /* Configure the system clock */<br>  SystemClock_Config();<br><br><br>  /* Initialize all configured peripherals */<br>  MX_GPIO_Init();<br>  MX_TIM2_Init();<br><br><br>  /* USER CODE BEGIN 2 */<br><br><br>  /* USER CODE END 2 */<br><br><br>  /* USER CODE BEGIN 3 */<br>  /* Infinite loop */<br>  while (1)<br>  {<br><span class="Apple-tab-span" style="white-space:pre">     </span>HAL_FLASHEx_DATAEEPROM_Unlock();<br><span class="Apple-tab-span" style="white-space:pre">        </span>HAL_FLASHEx_DATAEEPROM_Program(TYPEPROGRAM_HALFWORD, add, data);<br><span class="Apple-tab-span" style="white-space:pre">        </span>HAL_FLASHEx_DATAEEPROM_Lock();

Outcomes