Sony's Developer World forum

    • Home
    • Forum guidelines

    Spresense Hard fault issue with Arduino

    Spresense
    2
    2
    351
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      JITHUL last edited by

      Hi there,

      I am using Spresense board to test our NN model (converted the NN model to C-model and deployed in Spresense using Arduino). This C model is already verified in different SoC's.

      Pseudo code of the sketch:

      Setup:

         Initialize recorder (using Arduino Audio library).
      
         Start Recorder.
      
         Initialize our application.
      

      Dynamic memory allocation required for application.

      Loop:

         Read audio frame of 320 bytes.
      
         Check read size is 320 bytes.
      
         Do application process.
      

      Just to isolate if at all there is a memory conflict, I used the cut down version of the code to do the testing now. The model uses only 150KB, still encountered the Hardfault exception. I could track down the code to a point which causing the hardfault, but the observation seems to be weird.

      1.   First observation is that the exception is  caused by the exp() and powf() (lib in the math.h) used in a function and later commenting out these libs fixed the exception.
        

      a. For the exp(), though the algo doesn’t execute the exp() in the code snippet but simply having it in the code causes the issue. Later removed the exp() as this is no more required in the specific code snippet fixed the issue.

      b. For the powf(), replacing the same with its alternative code (it was power of 2, replaced with Multiplication) resolved the hardfault issue. But the same powf() in other previous functions did not cause any exception.

      1.   After fixing those mentioned above, the next function caused exception but there is not math.h lib used.
        

      Please see the console dump when Hard fault occurs.
      123.png

      K 1 Reply Last reply Reply Quote
      • K
        KamilTomaszewski DeveloperWorld @JITHUL last edited by

        Hi @jithul

        First of all, I would like to confirm whether a hard fault occurs during the execution of function dnnrt.forward();?

        Secondly, if you want to analyze the hard fault log you got, you can try the instructions from: https://forum.developer.sony.com/topic/66/up_assert-assertion-failed-at-file-manager-audio_manager-cpp-line-649-task-init/8

        Please try this and let me know what you got.

        Best Regards,
        Kamil Tomaszewski

        1 Reply Last reply Reply Quote
        • First post
          Last post
        Developer World
        Copyright © 2021 Sony Group Corporation. All rights reserved.
        • Contact us
        • Legal