Writing to user Flash during connection

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AmSa_4551891
Level 2
Level 2
5 replies posted 5 questions asked First reply posted

Hi ,

I am using the cy8c4128lqi-bl543 chip and my application requires to write sometimes to the user flash (~ 1 time per month).

I am writing to the flash during BLE connection with an App (the App send the field , I write it and then send Ack).

I see that in some cases , this action causes the BLE stack to stop working (Eventually ending in a WDT reset) . The function which is not returning a value (essentially  halting the system ) is the one below (When I want to send data):

pastedImage_0.png

Do you have any idea why it can happen?

0 Likes
1 Solution

Hi Amir,

Okay. Got it.

Please refer point 7 of the BLE troubleshooting guide obtained from the link below;

PSoC 4 BLE Troubleshooting Guide – KBA220490

Also please refer following thread:

Re: strange CyBle_GattsNotification behaviour

You need to use the following syntax for your application:

while(CyBle_GetBleSsState()!=CYBLE_BLESS_STATE_EVENT_CLOSE)

{

    DBG_PRINTF("\r\n waiting ");

}

  if(CyBle_GetBleSsState()==CYBLE_BLESS_STATE_EVENT_CLOSE)

    {

        CySysSFlashWriteUserRow(uint32 rowNum, const uint8 rowData[]);    //calling SFlash write

    }

}

Hope doing this will solve the issue. Kindly let us know if it it doesn't.

Thanks

Ganesh

View solution in original post

0 Likes
3 Replies
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

This behavior is expected. The following sentence is mentioned in page number 70 of PSoC 4 System reference guide attached with this response.

For PSoC 4000, PSoC 4100 BLE, PRoC BLE and PSoC 4200 BLE devices (PSoC 4100 BLE, PRoC BLE and PSoC 4200 BLE devices with 256K of Flash memory are not affected), this API will automatically modify the clock settings for the device. Writing to flash requires that changes be made to the IMO and HFCLK settings. The configuration is restored before returning. This will impact the operation of most of the hardware in the device.

So please check the status of the BLE i.e. whether the stack is busy or not before calling the Flash write event. Us the API as follows:

if (cyBle_busyStatus == CYBLE_STACK_STATE_FREE)

{

  //Do a flash write

}

Please try the above step once and let us know if the issue is resolved.

Thanks and regards

Ganesh

0 Likes

Thanks for the answer. but we are using cy8c4128lqi-bl543 , which has a 256KB flash. in this paragraph it is mentioned that it is not affected:

"For PSoC 4000, PSoC 4100 BLE, PRoC BLE and PSoC 4200 BLE devices (PSoC 4100 BLE, PRoC BLE and PSoC 4200 BLE devices with 256K of Flash memory are not affected)"

Am I missing something here?

0 Likes

Hi Amir,

Okay. Got it.

Please refer point 7 of the BLE troubleshooting guide obtained from the link below;

PSoC 4 BLE Troubleshooting Guide – KBA220490

Also please refer following thread:

Re: strange CyBle_GattsNotification behaviour

You need to use the following syntax for your application:

while(CyBle_GetBleSsState()!=CYBLE_BLESS_STATE_EVENT_CLOSE)

{

    DBG_PRINTF("\r\n waiting ");

}

  if(CyBle_GetBleSsState()==CYBLE_BLESS_STATE_EVENT_CLOSE)

    {

        CySysSFlashWriteUserRow(uint32 rowNum, const uint8 rowData[]);    //calling SFlash write

    }

}

Hope doing this will solve the issue. Kindly let us know if it it doesn't.

Thanks

Ganesh

0 Likes