Skip to main content
1123
Associate II
January 23, 2019
Solved

STM32F0 IAP USB problem

  • January 23, 2019
  • 2 replies
  • 725 views

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.

This topic has been closed for replies.
Best answer by Tesla DeLorean

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

2 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
January 23, 2019

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

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
1123
1123Author
Associate II
January 23, 2019

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();