interference between IAP and user application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-03-05 1:29 AM
Hi,
I can't use the same timer in IAP code and user application code in the same time, even if I reset all registers and interrupts concerning this timer before jump to user application address. Note that I reallocated the vector table for the user application...Thank you- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-03-05 6:08 AM
Hi
''I can't use the same timer in IAP code and user application code in the same time'' When you say IAP - In Application Programming. Do you mean that you have written your own bootloader? ''I reset all registers and interrupts concerning this timer before jump to user application '' In general - it is a good idea to disable and re-configure all peripherals to be used in each application during startup. In the case of the timer - the timer must be disabled first before some of its registers can be changed (or the change take effect).- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-03-05 6:58 AM
Ok, should we guess what part you're using, and the code you constructed that is failing?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-03-05 10:24 PM
Hi again,
Thank you for your replies,Yes it's my own bootloader. I am using STM32F105, and this is the way I reset all timer registers and the USB peripheral before jumping to the main application...if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000){ /* Reset all registers used in System file */ NVIC_DisableIRQ(TIM3_IRQn); RCC->APB1ENR &=~RCC_APB1ENR_TIM3EN; TIM3->CR1 = 0; // reset command register 1 TIM3->CR2 = 0; // reset command register 2 TIM3->PSC = 0; TIM3->ARR = 0; TIM3->DIER =0; // disable interrupt TIM3->CNT=0; TIM3->SR=0; /* Disable the USB clock */ RCC_APB1PeriphClockCmd((uint32_t)0x00800000, DISABLE); OTGD_FS_Handle_UsbReset_ISR(); PowerOff(); /* Jump to user application */ JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4); Jump_To_Application = (pFunction) JumpAddress; /* Initialize user application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) ApplicationAddress); Jump_To_Application(); }Note the USB causes the same problem, it seems it still working and when I plug in a USB cable, the main application crushes and after 3 resets the bootloader works again automatically ...thank you- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-03-05 10:40 PM
You might want to try programming the TIM3 registers BEFORE disabling the clock to the peripheral, as the writes definitely won't work after the clock is stopped.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-03-05 11:25 PM
Thank you cliv1, you are right about Timer3... can you help me about how to disable correctly the USB??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-03-06 1:32 AM
Hi
I found the USB stack from the USB OTG does re-initialise OK. The issue is to do with disconnection - you will need to force a software disconnect. Depending on your processor, something like // force a USB soft disconnect // USB_OTG_dev.regs.DREGS->DCTL |= 0x02;- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-03-06 1:52 AM
Thank you sung.chen_chung, that is what I did and it solved my problem ...
