This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PSTORAGE_MAX_APPLICATIONS

Hi Nordic, I am adding pstorage capability to ble_app_proximity example. Before adding pstorage, the example could receive Immediate Alert from a central and set on/off to a led. As referring to ble_app_template_with_pstorage_operations, I added pstorage functions to the example. The result was that pstorage_register() retuned NRF_ERROR_INVALID_PARAM. So I modified PSTORAGE_MAX_APPLICATIONS definition in pstorage_platform.h from 1 to 2. pstorage_register() returns no error, but Immediate Alert event cannot be received. Why does the modification of PSTORAGE_MAX_APPLICATIONS have a influence to Immediate Alert Service? It looks like that ble event does't occurs periodically after the modification. Please let me know the workaround. Thanks.

  • There is no direct link with the pstorage_register function with Alert event. Anyhow it seems that the pstorage_register function now succeeded after your change but after the program moved ahead there are some other failures in your code. It is difficult to say what it is without debugging. Did you verify that your program is running normally and still there are problems with Immediate Alert events?

  • Hi, Aryan. Thank you very much for your reply. I found that Immediate Alert event isn't received even though pstorage capability isn't used. I changed PSTORAGE_MAX_APPLICATIONS in pstorage_platform.h from 1 to 2 for ble_app_proximity application. The application cannot receive Immediate Alert event. The followings are printf trace.

    1) PSTORAGE_MAX_APPLICATIONS = 1
     0>  main: ble_evt_dispatch: ble_evt=0x01
     0>  main: on_ble_evt evt=1
     0>  main: ble_evt_dispatch: ble_evt=0x01
     0>  main: on_ble_evt evt=1
     0>  main: ble_evt_dispatch: ble_evt=0x50
     0>  main: on_isa_evt
     0>  main: alert_signal MILD_ALERT
    2) PSTORAGE_MAX_APPLICATIONS = 2
     0>  main: ble_evt_dispatch: ble_evt=0x12
     0>  main: on_ble_evt evt=18
     0>  main: ble_evt_dispatch: ble_evt=0x14
     0>  main: on_ble_evt evt=20
     0>  main: ble_evt_dispatch: ble_evt=0x12
     0>  main: on_ble_evt evt=18
     0>  main: ble_evt_dispatch: ble_evt=0x12
     0>  main: on_ble_evt evt=18
    

    In case 1), ble_evt_dispatch() receives periodically event(0x01, what is this?), but in case 2) it seems the function doesn't receive the periodical event. Has my application any incorrect setting? Could you please give me your advice on the workaround? Thanks.

  • Hi. When PSTORAGE_MAX_APPLICATIONS is 2, event though pstorage capability is no used, it seems that calling pstorage_init() is needed. When the calling is removed, it seems that NVIC_SystemReset() is called from somewhere before calling device_manager_init(). That is, main is called repeatedly. I uses the following code: static void device_manager_init(void) { err_code = pstorage_init(); APP_ERROR_CHECK(err_code); .... }

    int main(void) { ble_stack_init(); adc_configure(); timers_init(); APP_GPIOTE_INIT(1); bsp_init(....); device_manager_init(); .... } I am not sure that this phenomenon is related with Immediate Alert problem. Thanks.

  • NVIC_SystemReset is called from APP_ERROR_CHECK macro. In your application you call a function and the error code is returned (lets say) to err_code. Then when your app checks this error code APP_ERROR_CHECK(err_code), then it expects the err_code to be NRF_SUCCESS. Else something went wrong and it will call app_error_handler().

    The default behavior of this weakly linked function is to do a system reset, you can override this function to handle errors in the way you like. app_error_handler will be in the file app_error.c if i remember it correctly.

    regarding the other event that you were asking, I have answered it in your other question that you asked here

  • Hi, I have still the problem of Immediate Alert Service. I added SEGGER_RTT_WriteString() in the begging of SWI2_IRQHandler() in softdevice_handler.c and I sent Alert Level from Android phone using nrf Master Control program to PCA10028. The result is that SWI2 interrupt didn't happen according to sending Alert Level. I confirmed sending the Alert Level with BLE packet sniffer. My application has PSTORAGE_MAX_APPLICATIONS is 2 and is using SDK8.0.0 on S110_NRF51_8.0.0. Why dosen't the interrupt happen? Some configuration of my application is incorrect? Thank you very my in advance.

Related