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

nRF52840 Hard fault issue

Hi All,

I am working on the nRF52840 Zigbee protocol and I am using nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71 SDK.

With the help of engineers and other stuff, I am able to design my end product using Zigbee and Alexa communication.

My product is about, It is a Zigbee based light controlling device which uses Alexa as a command sending device for controlling brightness and On/Off.

It is the last stage of production but while testing we have an encounter with the Hardfault issue. And enable to trace and yet no solution found also I had been touch with nordic engineers from the start of my project to till today but we are not able to fix this issue yet.

Here is my ticket - https://devzone.nordicsemi.com/support/234827

My project, I am using 1 as Input pin ZCD (Zero Cross Detection pin), 1 as Output pin Trigger pin (Trigger for turning On/Off ), and 2 timers (Timer 4 and Timer 0).

Workflow - The device is powered with AC voltage, When there is ZCD detection using Timer as duty cycle (i.e., brightness level), we pass timer values for 0msec to 10msec (i.e., 0 % to 100%). This we pass for both the Positive cycle and the Negative cycle of the MOSFET trigger.

The result - While testing this device after 6 to 8 hours it enters into the hard fault handler we tried to figure out the issue but still no success. And as per one of your engineer suggestions, may be cause for hard fault issue is Timer 0 which is configured as continuous as we are using disable an interrupt routine. And as per his suggestion, we have configured timer 0 as a one-shot timer. You can check the ticket for more details.

After his suggestion, configured Timer 0 (which I am using in my project as a one-shot) but its interrupt routine means timer 0's interrupt routine not executing. Then we tried with other timers like 1 but the device starts flickering. And If configure the timer as a continuous timer using "nrf_drv_timer_extended_compare()" instead of one-shot as done before then it works smoothly.

I am not able to figure out this Hardfault issue and Timer one-shot issue.

Attached are my code and schematic file. Kindly help me to solve this issue as early as possible. It is very urgent for me as we are in the last stage of production only due to this hard fault issue we are stuck here.

nRF_Dimmer XXX-00-CIR.PDF

I am attaching 2 code, wherein one(Zigbee_Dimmer-0.9.4) we have used continuous timer and we stuck in hard fault issue. And another one(Zigbee_Dimmer-0.9.6.1) is where we have configured timer as a one-shot timer as a solution for hard fault issues.

a)Zigbee_Dimmer-0.9.4

Zigbee_Dimmer-0.9.4.zip

b)Zigbee_Dimmer-0.9.6.1

Zigbee_Dimmer-0.9.6.1.zip

Please help me to solve this issue.

Thanks in advance.

Rohit R

Parents
  • Hi Rohit

    1. You can do this by setting the NRF_LOG_BACKEND_UART_TX_PIN to a GPIO that is free in your project (I see that you have already set P0.10 as the TX pin in your project. This pin is reserved for the NFC antenna, so I suggest using another one, or set CONFIG_NFCT_PINS_AS_GPIOS  in your preprocessor definitions to use this pin as a regular GPIO. You also have to set NRF_LOG_BACKEND_UART_ENABLED to 1 in the sdk_config.h.

    2. What is TIMER1 used for in line 100 in the zb_nrf52840_timer.c file in your project?

    3. Thank you for clarifying.

    Best regards,

    Simon

  • Hi Simon,

    Thank you for the feedback,

    1. You can do this by setting the NRF_LOG_BACKEND_UART_TX_PIN to a GPIO that is free in your project (I see that you have already set P0.10 as the TX pin in your project. This pin is reserved for the NFC antenna, so I suggest using another one, or set CONFIG_NFCT_PINS_AS_GPIOS  in your preprocessor definitions to use this pin as a regular GPIO. You also have to set NRF_LOG_BACKEND_UART_ENABLED to 1 in the sdk_config.h.

    - Okay, I will follow this step and get back to you

    What is TIMER1 used for in line 100 in the zb_nrf52840_timer.c file in your project?

    - Sorry, but I do not know, It is already there I guess and I have not checked these files previously or not even edited. Maybe it by default in  SDK's light_bulb example and editing in main.c file other than that no other files where edited.

    Thanks and Regards

    Rohit R

  • Rohit Rajapure said:
    It is already there I guess

     Indeed, you're right, this is part of the Zigbee stack it seems, sorry about that! The Zigbee stack uses Timer1 already in nRF examples for timing beacon intervals, which explains why you're not able to use it like the other timers.

    Best regards,

    Simon

  • Hi Simon,

    Okay, thank you for the response,

    And timer 3 also used by Zigbee stack If I am not wrong because In my earlier phase when I started using nRF for my project. The below statement was stated by one of your engineers when I was configuring timer in Zigbee.

    "It seems your timer3 is using one of the timers ZB_INIT() is trying to initialize, which causes a halt. This is because the nrf_drv_timer_t TIMER_LED = NRF_DRV_TIMER_INSTANCE(3); tries to use the same timer instance as the ZIGBEE_TIMER_INSTANCE_NO uses in sdk_config.h."

    - So timer 1 and timer 3 are reserved in Zigbee.

    Thanks and Regards

    Rohit R

  • Hi Simon,

    Okay, Thank you so much for clearing the points.

    Also, I have observed one more thing, I might be wrong in this case but just observation.

    As I explained I am doing 2 projects which is similar and in both project, I am using same ZCD and Trimer method to control the brightness of LED/bulb.

    As I told my current version code also got into hard fault handler after 4 hours on Dev-kit as well as on Custom hardware. And my previous hardware also uses to stuck in a hard fault handler. And in both projects, I am using timer 0 for some controlling functionality. What I suspect is Timer 0 is the one causing the issue. I  am not sure, my assumption might be wrong.

    I am saying timer 0 might the issue because in current version of project I have conducted one test case. Here, what I did is I have just removed the timer 0 from my project and used timer 2 and timer 4 only for my controlling part and the code worked on Dev-kit for 6hours though I have not tested it completely by running 24hours but my observation after commenting timer0 part for code, the code run for 2hours extra time. So this might be the issue. But again I have not tested it for long time. It is jsut observation.

    Let me know your views on this.

    Thanks and Regards

    Rohit R

Reply
  • Hi Simon,

    Okay, Thank you so much for clearing the points.

    Also, I have observed one more thing, I might be wrong in this case but just observation.

    As I explained I am doing 2 projects which is similar and in both project, I am using same ZCD and Trimer method to control the brightness of LED/bulb.

    As I told my current version code also got into hard fault handler after 4 hours on Dev-kit as well as on Custom hardware. And my previous hardware also uses to stuck in a hard fault handler. And in both projects, I am using timer 0 for some controlling functionality. What I suspect is Timer 0 is the one causing the issue. I  am not sure, my assumption might be wrong.

    I am saying timer 0 might the issue because in current version of project I have conducted one test case. Here, what I did is I have just removed the timer 0 from my project and used timer 2 and timer 4 only for my controlling part and the code worked on Dev-kit for 6hours though I have not tested it completely by running 24hours but my observation after commenting timer0 part for code, the code run for 2hours extra time. So this might be the issue. But again I have not tested it for long time. It is jsut observation.

    Let me know your views on this.

    Thanks and Regards

    Rohit R

Children
No Data
Related