nusrobomaster / nuttx

Apache NuttX is a mature, real-time embedded operating system (RTOS)
https://nuttx.apache.org/
Apache License 2.0
0 stars 0 forks source link

I2C and SPI support for Dev A #6

Open chengguizi opened 3 years ago

chengguizi commented 3 years ago

Development Board A has the following peripherals:

IST8310

MPU6500

After initial investigation, the I2C interface seems not needed. SPI5 is used by MPU6500 (PF6 to PF9)

There are interrupt pins as well: PB8 for MPU6500 PE3 for IST8310

IST8310 has an additional PE2 as the set/reset pin

There is a header around IMU unit, PWM controlled by PB5. image

chengguizi commented 3 years ago

On Dev Board A, SPI4 and SPI5 are connected

SPI4 is not used, but connected to the user defined pinouts SPI5 is connected to the IMU

There is a system tool that can be enabled within nsh, should set the maximum bus number from 3 to at least 5

image

It will check if the file /dev/spi%d exist. This shows that if spi is working, it should mount itself within the /dev/ folder

chengguizi commented 3 years ago

image image

Successfully bring up SPI 4 and 5, but have not tested with the real IMU driver yet. The config is to be pasted into PX4 Autopilot, for testing. After that, will merge into main branch here.

The working commit: 2919d6b7786b9467a43540557d8e0755c6ac3b3c

Note: stm32_spibus_initialize(int) is the key function to call, to initialise SPI, I believe.