Skip to main content
1123
Associate II
Jan 23, 2019 1:23 PM UTC
Solved

STM32F0 IAP USB problem

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.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Jan 23, 2019 1:56 PM UTC

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..

2 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Jan 23, 2019 1:56 PM UTC

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
Jan 23, 2019 2:26 PM UTC

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