AnsweredAssumed Answered

In application programming over i2c

Question asked by fog.kenneth_blaabjer on Nov 14, 2014
Latest reply on Nov 17, 2014 by Clive One
Hi all,

I am trying to implement IAP over I2C in my STM32L151CB processor. 

I have a IAP-program and a Main Application-program. These two programs are completely separate uVision projects in the Keil development environment. 

I have allocated the IAP-program to flash address (0x08000000) and the Main Application-program to (0x08010000), just for test. 

Right now all the IAP-program is doing is to jump to the Main Application-program. 

     uint32_t JumpAddress;
     uint32_t APPLICATION_ADDRESS = MainProgramStartPage;                    // Base of main application program 0x08010000

     JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);     // Always set the application base address + 4 (This is where the init program starts)
     Jump_To_Application = (pFunction) JumpAddress;                                   // Set the address
     __set_MSP(* ( __IO uint32_t* ) APPLICATION_ADDRESS);                    // Set Stack Pointer
     Jump_To_Application();                                                                                               // Jump to address

This seems to work. But when the Main Application-program is running it does not store the variables in my buffers anymore. It seems that the two programs are interfering with each other in the SRAM. But when I try to change the SRAM start location of the Main Application-program from (0x20000000) to (for example: 0x20002000), the program does not work at all!?

Is there something I dont know about the SRAM, since I can not change its location without crashing the program? 

I want the two programs to be completely separate. With allocated flash and SRAM for each. 

Any answer is greatly appreciated, 

Kind regards
Kenneth

Outcomes