Raspberry Pi Sample Code for MMS101

[History]
       DD.MM.YYYY Version  Description
       24.12.2024 1.0.0.0  First Release

[Operating environment]

    - Hardware
      Raspberry Pi 4B

    - Kernel version
      5.4.51-v7l+ (Linux raspberrypi)

    - pin configuration (J8 connector)
       1pin - VDDIO
       2pin - VDD
       6pin - SG
      19pin - SDI
      21pin - SDO
      23pin - SCLK
      29pin - CSB5
      31pin - CSB4
      33pin - CSB3
      35pin - CSB2
      37pin - CSB1

      * CSB is controlled as a GPIO port.

    - Enable SPI driver
      % sudo raspi-config
         [5.Interfacing Options] > [P4 SPI] > [Yes] > [Yes] > [Finish]

      % sudo reboot


[File list]
    mms101.c       : MMS101 Sample Source File
    mms101.h       : MMS101 Sample Source Header File
    spidrv.c       : SPI Function Source File
    spidrv.h       : SPI Function Source Header File
    Makefile       : make file


[Introduction]

    1. Login RaspberryPi
    
    2. Copy mms101 folder to RaspberryPi (scp command etc.)
    
    3. Build mms101 access module
    
        % cd mms101_SDK_for_raspberrypi_sample_code_ver.1.0.0.0
        % make
    
        -> Output File: mms101


[Execution mms101]

      Usage: mms101 [Number of CN<n>][Number of measurements]
    
      ex.) When the connectors used are CN1, CN3, and CN5, and the number of measurements is 10
        
        % ./mms101 1 3 5 10

        time[s],Fx,Fy,Fz,Mx,My,Mz
        0.001668,1.714,1.023,-33.742,-0.04221,-0.00781,0.00459
        0.002724,1.741,1.020,-33.510,-0.04199,-0.00784,0.00462
        0.003750,1.748,0.999,-33.427,-0.04206,-0.00777,0.00442
        0.004772,1.774,1.001,-33.357,-0.04209,-0.00759,0.00461
        0.005792,1.739,1.005,-33.266,-0.04209,-0.00767,0.00486
        0.006810,1.767,1.009,-33.069,-0.04200,-0.00757,0.00454
        0.007829,1.773,1.040,-33.026,-0.04194,-0.00748,0.00540
        0.008849,1.768,0.988,-32.937,-0.04187,-0.00759,0.00451
        0.009866,1.727,1.004,-32.817,-0.04196,-0.00767,0.00524
        0.010885,1.740,0.978,-32.800,-0.04179,-0.00790,0.00569

      ex.) Output log file

        % ./mms101 10 > log.txt


[Option]

    - Adjustment of data acquisition timing

      The timing can be adjusted by modifying the "DATARATE_TIME_US" macro in mms101.h.
      The minimum value is about 950us.
      (initial value:1000us)

    - Adjustment of restart timing (re-acquisition of temperature data for temperature correction)

      The timing can be adjusted by modifying the "RESTART_INTERVAL_NUM" macro in mms101.h.
      The restart command is issued after the data is acquired for the times of the set value.
      If the set value is "0", the restart command will not be issued.
      (initial value: 0)

