cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

New Contributor II

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
Reply
1 Solution
Moderator
Moderator

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
Reply
3 Replies
Moderator
Moderator

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
Reply
New Contributor II

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
Reply
Moderator
Moderator

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
Reply