Community
cancel
Showing results for 
Search instead for 
Did you mean: 
RKura
New Contributor I
1,702 Views

Intel Aero Compute board Sensors

Hi,

I am wondering what the best way is to start learning about the onboard sensors and how to program them. I want to be able to see the data captured by the Sensors.

I found this on the WIKI

https://github.com/intel-aero/meta-intel-aero/wiki/90-%28References%29-Flight-Controller-and-Compute... 90 (References) Flight Controller and Compute Board: Sensors GPIOs LEDs CAN bus · intel-aero/meta-intel-aero Wiki · GitH…

Are there any sample code examples that would help me understand how to detect and program and get data from these Sensors ?

Thanks

Rohan

0 Kudos
4 Replies
RKura
New Contributor I
72 Views

I ran this sample code

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/Documentation/spi/spide... spidev_fdx.c\spi\Documentation - kernel/git/stable/linux-stable.git - Linux kernel stable tree

This is what I got -

response(32, 33): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 28 03 28 00 0b 88 80 10 00 00

read(32, 32): 00 00, 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Does anyone know how to read this output ?

This is the code here that does the work of transfer and receive

int len = 32;

buf[0] = 0xaa;

xfer[0].tx_buf = (unsigned long)buf;xfer[0].len = 1;

xfer[1].rx_buf = (unsigned long) buf;xfer[1].len = len;

status = ioctl(sfd, SPI_IOC_MESSAGE(2), xfer);

What is buf[0] = 0xaa ? Is that a command ?

When I changed buf[0] = 0x80, I got

response(32, 33): d1 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 77 a4 9e 10 00 00 00 00

The response changed. Is buf[0] a command that returns some data in the rx buffer ?

best

Rohan

idata
Community Manager
72 Views

Hi Rohan,

Thanks for your interest in the Intel® Aero™ Platform.

Unfortunately, there are no sample codes besides the one you have pointed out in your second reply. Please let me investigate what the outputs on this code https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/Documentation/spi/spide... spidev_fdx.c\spi\Documentation - kernel/git/stable/linux-stable.git - Linux kernel stable tree means.

We appreciate your patience, have a nice day!

Best Regards,

 

-Jose P.
RKura
New Contributor I
72 Views

Thanks Jose. Looks like the buf[0] set in tx_buf is definitely a command. And rx_buf is the response. If you can help me figure out what the different possible commands that can be set in tx_buf and what they mean, that would help me.

Rohan

idata
Community Manager
72 Views

Hi Rohan,

Analyzing the Linux sample code, we realize that this is just an SPI interface, so if you are interested in knowing more about this I would encourage to review the sensor datasheet (http://www.mouser.com/ds/2/783/BST-BMI160-DS000-07-786474.pdf http://www.mouser.com/ds/2/783/BST-BMI160-DS000-07-786474.pdf ), especially the Digital Interface section.

Also, I would recommend to investigate how spi_xfer works this a standard protocol used in many Embedded Systems.

Hope you find this information useful, have a nice day!

Best Regards,

 

-Jose P.
Reply