Hi Bitcraze:
i want to mount sensors to CF2, the sensor need communicate with CF2 by uart , i know the CF2 have uart1 and uart2 let me use,but i don't know how to configure the uart,and don't know which function can i use,and which folder/file can i write my code(it is run the RTOS, i dont't know where to create my task ).i try to comprehend the crazyflie-fireware, but it is too complicate to me do modify it.
so what should i do (eg. which function can i use) can let the CF2 receive the sensor's date and then send the date to the host computer.
How to configure the uart interface and use easily
Re: How to configure the uart interface and use easily
Hi,
You can make a deck driver and there is a pretty easy API to use the UART of the expansion port.
For example I recently played with a vive/lighthouse receiver implemented in a Teensy, I connected the UART of the teensy to the expansion port UART1 and this code allowed me to interface it: https://gist.github.com/ataffanel/38890 ... 058dab4471. The position I got from the teensy are accessible to the computer in log variables (at the bottom).
Not all the includes might be required (I started from a copy-paste of one of the GPS driver ...) but hopefully this should give you a good starting point.
You can make a deck driver and there is a pretty easy API to use the UART of the expansion port.
For example I recently played with a vive/lighthouse receiver implemented in a Teensy, I connected the UART of the teensy to the expansion port UART1 and this code allowed me to interface it: https://gist.github.com/ataffanel/38890 ... 058dab4471. The position I got from the teensy are accessible to the computer in log variables (at the bottom).
Not all the includes might be required (I started from a copy-paste of one of the GPS driver ...) but hopefully this should give you a good starting point.
Re: How to configure the uart interface and use easily
ok, thank you ,i will try it, i find out my sensor need +4~8V power,but the vcc of CF2.0 only around +3.3V,so can you give me advice to solve it?
Re: How to configure the uart interface and use easily
You can use a separate battery, or use a step-up power supply. We have already used a step-up for an fpv setup and it worked well. Though, the exact solution depends of your sensor, for instance how clean the power supply has to be.
Be careful that IO of the Crazyflie are 3.3V. So you also need voltage-translation electronic for the data lines. For the line from your sensor to the Crazyflie it could be as simple as 2 resistor to make a voltage divider, but it must be there.
Be careful that IO of the Crazyflie are 3.3V. So you also need voltage-translation electronic for the data lines. For the line from your sensor to the Crazyflie it could be as simple as 2 resistor to make a voltage divider, but it must be there.