cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 IAP USB problem

1123
Associate II

I use __HAL_SYSCFG_REMAPMEMORY_SRAM(); this function ,but MX_USB_DEVICE_Init(); can't work.

After I went to debug tool ,it appear cannot access memory this problem.

I don't know how to solve it.

Maybe it should register address problem,or init address error.

1 ACCEPTED SOLUTION

Accepted Solutions

If you don't see ROM mapped, check SYSCFG clock is enabled prior to remapping.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

If you don't see ROM mapped, check SYSCFG clock is enabled prior to remapping.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
1123
Associate II

this is my main code .

I can current SYSCFG clock is enabled status .

If I want to see ROM mapped, I should watch memory address 0x08004000 ,isn't.

#define MAIN_CODE_ADDRESS  0x08004000

__IO uint32_t VectorTable[48] __attribute__((section(".RAMVectorTable")));

int main(void)

{

 /* USER CODE BEGIN 1 */

uint32_t i = 0;

 /* USER CODE END 1 */

 /* MCU Configuration----------------------------------------------------------*/

 /* Reset of all peripherals, Initializes the Flash interface and the Systick. */

HAL_DeInit();

 HAL_Init();

 /* USER CODE BEGIN Init */

 /* USER CODE END Init */

 /* Configure the system clock */

 SystemClock_Config();

 /* USER CODE BEGIN SysInit */

for(i = 0; i < 48; i++)

 {

  VectorTable[i] = *(__IO uint32_t*)(MAIN_CODE_ADDRESS + (i<<2));

 }

__HAL_SYSCFG_REMAPMEMORY_SRAM();

 /* USER CODE END SysInit */

 /* Initialize all configured peripherals */

 MX_GPIO_Init();

 MX_DMA_Init();

 MX_I2C1_Init();

 MX_CAN_Init();

 MX_USB_DEVICE_Init(); //cannot access memory

 MX_USART3_UART_Init();

 MX_DAC_Init();

 MX_ADC_Init();

 MX_TIM1_Init();