Shalom!
We are building a custom prototype Nordic nRF9160 board with the lsm6dsl spi chip in parallel on the same spi channel as the MX25R6435F flash memory chip.
I am new to Zephyr and mostly have programmed without any RTOS directly, bare metal, accessing the devices.
I need to program (and read) most all of the lsm6dsl's registers including reading the lsm6dsl's fifo before it overflows.
I understand that in the lsm6dsl sample that the sensor wrapper is used along with interrupts for motion detection.
We do not need any motion detection but just to take acceleration readings for a period of a several seconds.
Since the acceleration readings are at a know frequency ad the fifo size is constant, we do not have to use an interrupt by using a FIFO threshold, but by constantly emptying the FIFO.
I have code that works well using a Silabs mico-controller.
I looked at the sensors/lsm6dsl files including lsm6dsl_spi.c which seems to have basic read and write register static functionality but I do not know how this is reflected (or mapped) to the high level sensor functions like sensor_attr_set() sensor_attr_get() sensor_sample_fetch_chan() & sensor_channel_get().
Also I do not see how to specify each chip select for devices on the same SPI bus.
I am new to the prj.conf, Kconfig, CMakeLists.txt & .overlay files.
I created an overlay file and based on what I saw added the following:
&spi3 {
status = "okay";
sck-pin = <13>;
mosi-pin = <11>;
miso-pin = <12>;
cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
/* ST Microelectronics LSM6DSL accel/gyro sensor */
lsm6dsl@1 {
compatible = "st,lsm6dsl";
reg = <1>;
spi-max-frequency = <1000000>;
irq-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
label = "LSM6DSL_SPI";
};
mx25r64: mx25r6435f@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <8000000>;
label = "MX25R64";
jedec-id = [c2 28 17];
sfdp-bfp = [
e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
];
size = <67108864>;
has-dpd;
t-enter-dpd = <10000>;
t-exit-dpd = <35000>;
};
};
We also have a 24LC512 EEPROM and a SI7050 temperature chip on the same I2C line, so the answer on how to specify their individual cs may be the same.
So basically I am asking:
1) How do I map the high end sensor functions to the lower end spi functions?
2) How do I differentiate between their cs lines?
If anyone can help or has a Zephyr example with the lsm6dsl , 24LC512 or the SI7050 let me know.
Thanks
David