currently I'm done with the development of my ChibiOS application. In order to do firmware updates, we need to have a bootloader.
The bootloader is (due to its size) a bare metal app that reads a I2C register to determine to jump to the ChibiOS app (flash : org = 0x0800F000, len = 452k) or stay in bootmode (flash : org = 0x08000000, len = 60k) to receive the new firmware and flash the binary at offset 0XF000.
The startup and determination whether to jump to app or stay in boot works fine; As does the jumping to the ChibiOS app. I reach the ChibiOS-main function (through the reset handler) and when I try to do a i2cMasterTransmitTimeout both the SCL and SDA are pulled low, but no byte emerges the STM32 F103VET6. The i2cAcquireBus function seems to be successful. After that the whole MCU freezes and I get "Warn : Timeout (1000ms) waiting for ACK=OK/FAULT in JTAG-DP transaction" in my GDB. Only a power cycle can revive the STM32.
When I run the ChibiOS app standalone from 0x08000000 (thus without bootloader) it all works like a charm.
The jump_to_application function looks like this:
Code: Select all
void jump_to_application()
{
    typedef void (*pFunction)(void);
    pFunction Jump_To_Application;
    /* variable that will be loaded with the start address of the application */
    vu32* JumpAddress;
    const vu32* ApplicationAddress = (vu32*) APPLICATION_ADDRESS;
    /* get jump address from application vector table */
    JumpAddress = (vu32*) ApplicationAddress[1];
    /* load this address into function pointer */
    Jump_To_Application = (pFunction) JumpAddress;
#if defined(BOOT_MAX7311)
/* Disable and reset I2C1 PHY */
    I2C_Cmd(I2C1, DISABLE);
I2C_DeInit(I2C1);
#endif
    /* reset all interrupts to default */
    NVIC_DeInit();
    /* set stack pointer as in application's vector table */
    __MSR_MSP((u32) (ApplicationAddress[0]));
    Jump_To_Application();
}Â It makes no difference whether I run the I2C_Cmd(I2C1, DISABLE); or not.
I'm quite stuck on this one. I hope one of you could help me out
Thanks in advance,
Matis
Edit; When halting the target after entering the i2cMasterTransmitTimeout function. The I2C1_SR1->SB is altered from 0 to 1, so the PHY is in the "Start bit send (Master)" state. But nothing more happens. Not even the timeout is triggered.