MC3630 - Accel sensor

MC3630 - accelerometer

Accelerometer using SPI bus.

Available only when board BEHAVIOR <PAL_MOT> <PAL_NOTICE> is loaded. Procedures of common methods except begin(), available() are executed in board BEHAVIOR.

Operation flow

1..begin(): Sensor operation starts 2. 2.PIN_SNS_INT interrupt or available(): FIFO queue reaches the specified number 3. 3..get_que(): Get data from the FIFO queue

Procedures required for operation

SPI bus

None in particular.

Sleep procedure

To wake up by PIN_SNS_INT interrupt, the following settings must be made before sleep.

pinMode(PAL_MOT::PIN_SNS_INT, WAKE_FALLING);

Procedures for waking up from sleep

A call to the .wakeup() method is required. This process is executed in the <PAL_MOT> board BEHAVIOR.

If the semiconductor's internal FIFO queue is full and no read is performed, the data acquisition is terminated and no new values are stored.

Data Structure

Each sample is stored in a queue smplque whose elements are axis_xyzt structures. The members x,y,z correspond to the X, Y, and Z axes, respectively.

struct axis_xyzt {
  int16_t x;
  int16_t y;
  int16_t z;
  uint16_t t;
};

The value of each axis is stored as a value where 1G is 1000. The t is the sample number, which is assigned to each sample in order from 0.

Methods

read()

uint8_t read()

Reads data from a semiconductor FIFO queue. The number of bytes read is returned, but be sure to read the number of data stored in the size of the queue referenced by .get_que().

After returning from sleep, <PAL_MOT> will do read().

get_que()

smplque<axis_xyzt>& get_que()

Get a sample of the acceleration. The queue is smplque with axis_xyzt as an element; the queue should be emptied as soon as it is available.

Common methods

setup()

void setup() 

This sensor does not use setup().

begin(), end()

void begin(uint32_t conf)
void end()

Initialize with the settings specified in conf.

conf[0:15] (bit0-15): sampling mode, conf[16:23] (bit16-23): range of acceleration, conf[24:31] (bit24-31): number of samples until interrupt occurs.

conf[0:15] sample modecontents

MODE_LP_1HZ_UNOFFICIAL

1Hz Low Power (unofficial setting)

MODE_LP_2HZ_UNOFFICIAL

2Hz Low Power (unofficial setting)

MODE_LP_7HZ_UNOFFICIAL

7Hz Low Power (unofficial setting)

MODE_LP_14HZ

14Hz Low Power (default)

MODE_LP_28HZ

28Hz Low Power

MODE_LP_54HZ

54Hz Low Power

MODE_LP_105HZ

105Hz Low Power

MODE_LP_210HZ

210Hz Low Power

MODE_LP_400HZ

400Hz Low Power

MODE_ULP_25HZ

25Hz Ultra Low Power

MODE_ULP_50HZ

50Hz Ultra Low Power

MODE_ULP_100HZ

100Hz Ultra Low Power

MODE_ULP_190HZ

190Hz Ultra Low Power

MODE_ULP_380HZ

380Hz Ultra Low Power

Unofficial settings are not described in the MC3630 datasheet and their behavior is undefined. Please check the behavior of the settings before using them. We are not able to answer any questions or problems related to the unofficial settings.

conf[16:23] Acceleration rangeContents

RANGE_PLUS_MINUS_8G

±8G (default)

RANGE_PLUS_MINUS_4G

±4G

RANGE_PLUS_MINUS_2G

±2G

RANGE_PLUS_MINUS_1G

±1G

process_ev()

void process_ev(uint32_t arg1, uint32_t arg2 = 0)

This sensor does not use process_ev().

available()

bool available()

Returns true if data is read out to the sensor and stored in the internal queue.

probe()

bool probe()

You cannot use probe() with this sensor.

wakeup()

void wakeup()

Reinitializes the SPI bus after sleep recovery and reads acceleration data.

最終更新