"Bluetooth Data Acquisition module" -02-sensor Controller writes CC2650STK peripheral driver

Source: Internet
Author: User

The last time we talked about all the sensor modules read and write in the sensors controller and encapsulate the driver.

Let's take a look at CC2650STK's schematic diagram.

Dio_0~dio_7 marked with a red box, dio_23~dio_30 can be controlled by the sensor controller. The latter few are temporarily used, and the front includes an I²c interface, and two button button pins, as well as a reed reed tube pin. The remaining TMP Rdy,audio,mpu int is no more.

The driver and data acquisition program under driver Sensor controller is now being written to the I²c interface and 3 input pins.

The I²c interface of SDA and SCL is connected with 4 sensor chips, namely OPT3001 illumination, BMP280 pressure, TMP007 infrared temperature, HDC1000 humidity. The datasheet and drivers for these sensors can be downloaded from the official website, and the driver is written in sensor Controller Studio, referring to the official driver. 3 input signals, create a task to write the corresponding program, read the input status of the PIN. Only the data delay operation is used in the i²c, and the input signal uses the timer interrupt function.

The structure of the final project is as follows:

With 5 pins, the I²c sensors task used two pins, and the IO sensors task used three pins.

The last generated driver code consumes 95.6% RAM resources, which is basically used up. If you need to add something else, you can only streamline the driver code, such as removing some initialization steps, and so on.

In the writing drive, it is found that the temperature and humidity of HDC1000 reading i²c communication process is relatively special, need to trigger the measurement (write access, write 0 bytes to the temperature register), read wait for the measurement to complete (loop read access until there is an ACK signal), read the measurement results (temperature 2 bytes, Humidity 2 bytes).  Light is not very clear in words, you need to read the manual to understand this. The middle mentioned read wait measurement is complete (loop read access until there is an ACK signal), and here I measure always the No. 353 time before the ACK return, do not know what the specific reason.

Using the task testing tool to test the effect of the I²c sensors task, you can see that the sensor controller has been able to read all the data that is of interest.

The driver code in the IO sensors task is relatively simple and interesting to see the source code.

~ ~ Finished, in fact, spent a lot of time to tune the drive, the main reason is the above mentioned HDC1000 cycle read the relationship, but finally is finally done.

The source code of the project can be seen on the link below.

Https://coding.net/u/vacajk/p/Exploration_Sensors/git

The next step is to implement the ability to interact with the sensor controller in the M3 kernel.

"Bluetooth Data Acquisition module" -02-sensor Controller writes CC2650STK peripheral driver

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.