Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    Storing data with high sampling rate (e.g. acceleration data)

    Established Member

    Re: Storing data with high sampling rate (e.g. acceleration data)

    Hello JanGieseler,

    As per your requirements, the best option would be go for the double task and double buffer concept as explained by LlobetAtWork.

    That way data acquisition and SD card write operation both can be handled and yor desired sample frequency can also be met.

    With regards to your query on impact of MITA, it is only an alternate and simpler language to generate c code using simpler syntax.

    The auto-generated code will still have the same task execution time and the software  will not have much change w.r.t system timings.

    Some insights on your other queries

    1.  how do I check the actual loop execution time?

    Simplest way would be to do a diff of the tick counts before and afer execution within the loop.

    2.  is there an error if the actual loop execution time is longer than the specified 10ms ? If so, how do I catch it?

    You can add a timer in your sstem to have accurate measurements or use a semaphore to detect lags

    3. can I run 2 parallel threads, one that acquires the data into a buffer and one that writes the buffer to the SD card? I tested with two `every xx milliseconds {} ` loops but this didn't work

    Yes, you can create two tasks, one to get sensor data and other to write to Sd card.

     

    Regards,

    Shanmathi P

     

    Member

    Re: Storing data with high sampling rate (e.g. acceleration data)

    Thanks  for the reply. 

    Just to be clear, the solutions (` do a diff of the tick counts`, `add a timer in your sstem`, `create two tasks`) you propose are implemented in the C Code and can not be implemented directly in MITA, right?

    Established Member

    Re: Storing data with high sampling rate (e.g. acceleration data)

    Hi JanGieseler,

    Calulating tick count diff and timers can be done using mita. Already in the code which you have shared, on every 10 ms timer has been created.

    But currently creation of tasks is not supported in Mita.

    So you will have to implement the dual task logic in normal embedded c code.

     

    With Regards,

    Shanmathi P

    Member

    Re: Storing data with high sampling rate (e.g. acceleration data)

    I understand that one can easily implement a timer in MITA. My question is how do I make sure that the code in the timer gets executed at the specified interval in the case that the code within the loop takes longer than the loop interval.

     

    every 1 milliseconds {
       function_that_takes_2ms();
    }

     

    Would the above code throw and error or would the loop interval simply be 2ms?

     

    Thanks!

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist