Other Parts Discussed in Thread: BLE-STACK
Dear Sirs
I have a very strange beahaviour of the BIM code.
I have a board with a CC2640R2 and an Adesto Flash together with other circuits on the SPI, so I need to change the BIM.
I can download a new application software using OAD onto my Adesto Flash, this works very well.
But the new program doesn't start.
If I press the reset button the BIM transfers the application from the externa flash into the internal flash, but the new program still doesn't start.
If I now activate the pre-definition "NO_COPY" then my downloaded software starts perfectly.
So OAD and the flashing of external and internal flash works!
When I remove NO_COPY then the application software never starts.
After much works I have a theory that it is the GPIOs that are the root of my problem. It seems that the GPIOs in BIM is sensitive to time.
Please see the code below. At the last line I change a pin. If the delay preceding that is very short then the last pin change works fine. If the delay is long (100mS) the it seems that this PIN change makes the BIM freeze.
bool extFlashOpen(void)
{
bool f;
uint32_t i;
volatile uint32_t x;
bspSpiOpen(SPI_BIT_RATE, BSP_SPI_CLK_FLASH); / I have not changed anything inside this function.
/* GPIO pin configuration */
IOCPinTypeGpioOutput(FLASH_PWR); // Powers on my Adesto Flash
IOCPinTypeGpioOutput(BSP_IOID_FLASH_CS); // Flash CS
IOCPinTypeGpioOutput(ACC_CS);
IOCPinTypeGpioOutput(GFE_CS);
/* Default output to clear chip select */
GPIO_setDio(FLASH_PWR); // Power on Flash
GPIO_setDio(BSP_IOID_FLASH_CS); // Flash CS high
GPIO_setDio(ACC_CS); // ACC CS high so it doesn't disturb
GPIO_clearDio(GFE_CS); // GFE CS for debug
// The routine below gives a delay of 150mS so that the Flash wakes up properly before we do anything
for (i=0;i<800000;i++) // 800000
{
x=(x+10)/2; // Dummy
}
GPIO_setDio(ACC_CS); // GFE CS high used for debug, works if delay above is very short
Any ideas are highly welcome.
/Dan