Other Parts Discussed in Thread: CC2540
Hi,
I have a problem with events in cc2540.
I have a event called SBP_UPDATE_MEM_EV to write in a spi memory. When the event is executed the comunication fall and the device (phone) show me "disconnect of device".
if ( events & SBP_UPDATE_MEM_EVT )
{
update_memory();
return ( events ^ SBP_UPDATE_MEM_EVT );
}
static void update_memory(void){
SPIFlashWriteEnable();
SPIFLASH_erase_sector(0, 0);
//NAME
SPIFlashPageWrite(0x000000, NAME, sizeof(NAME));
//PUK
SPIFlashPageWrite(0x000100, PUK, sizeof(PUK));
//PIN
SPIFlashPageWrite(0x000200, PIN, sizeof(PIN));
//GPS_INT
SPIFlashPageWrite(0x000300, (unsigned char *)TIME_GPS, sizeof(GPS_INT));
}
It's weird because if I only I execute the first two or the last 4 instructions in update_memory() it works fine, but if I execute all instruction, the communication fall.
Why that is happen?
Thanks.