Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support of LSM6DS33 IMU to TX16S via AUX1 port #617

Merged
merged 4 commits into from
Aug 24, 2021
Merged

Conversation

rotorman
Copy link
Member

@rotorman rotorman commented Aug 21, 2021

This PR adds support of LSM6DS33 IMU to RadioMaster/Eachine TX16S via AUX1 port.
With new CMake key IMU_LSM6DS33, std. serial USART3/AUX1 will be converted to second I2C bus (first internal I2C bus is for touchscreen on TX16S).

Gathering data from IMU can be triggered by calling imu_lsm6ds33_read() and it's output is saved in SI units into internal variable IMUoutput of following structure type:

typedef struct {
float fTemperatureDegC; //°C
float fAccX, fAccY, fAccZ; // m/s^2
float fGyroXradps, fGyroYradps, fGyroZradps; // rad/s
} sIMUoutput;

Do note that the current PR does NOT trigger reading the IMU automatically, which in later application phase could be added, e.g. to be triggered periodically at a desired frequency, for example in:

void per10ms()

The temperature, gyro and linear acceleration values of LSM6DS33 can be displayed at radio analogs dialog screen in SI-units. Here Adafruit LSM6DS33 breakout during simultaneous testing with FlySky Paladin EV digital gimbals on RM TX16S:
DSC_0176

…option -DIMU_LSM6DS33=YES the std. serial USART3/AUX1 functionality is changed to I2C2 bus.

The temperature, gyro and linear acceleration values of LSM6DS33 are sampled and displayed at radio analogs dialog screen in SI-units.
Using "*_B1_*" for first logical I2C bus and "*_B2_*" for second logical I2C bus (instead of less clear I2C and I2CX).
rotorman added a commit to rotorman/edgetx that referenced this pull request Aug 22, 2021
@Stinky80
Copy link
Contributor

возможно это добавить "последовательный USART3 / AUX1 будет преобразован во вторую шину I2C" в jumper t16? если да - то можно попробовать вписать на эту шину touch screen для аппаратный модификаций.

@rotorman
Copy link
Member Author

rotorman commented Aug 23, 2021

Hi Stinky80,
you are asking if it is possible to convert USART3/AUX1 on Jumper T16 to I2C bus? You suggest to use it for touch screen.

Jumper T16 does not configure any pins for I2C yet, but the same USART3 RX and TX pins (PB10, PB11, Pin 90 and Pin 91 on STM32F429BIT6) can be used for Jumper T16 for I2C2 as well. It would also be possible to have touch screen AND IMU on the same I2C bus, so both would theoretically work, assuming there is a mechanically fitting touch screen with GT911 for Jumper T16.

@Stinky80
Copy link
Contributor

Stinky80 commented Aug 23, 2021

Привет Rotorman. Теоретически чуть позже можно сделать модуль-переходник для подключения сенсора tx16s (gt911) и акселерометра на шине i2c . места над процессором хватает для ещё одной платы под отсеком батареи. Можно использовать конфигурацию tx16s по калибровке сенсора и размещению коннектора. Только мне надо точные размеры платы tx16s. Увы у меня нет RadioMaster:( когда Я купил t16 RadioMaster ещё даже не выпустили.

@Stinky80
Copy link
Contributor

Stinky80 commented Aug 23, 2021

Так-же думаю можно на дополнительном контроллере сделать вилку... Имею ввиду дополнительный контроллер на 2 порта uart для AUX2 (usart6) для одновременного использования frsky Bluetooth и GPS . только думаю надо будет добавить запросы к порту что мы вызываем в данный момент. Очень интересно использовать внутренний GPS как позиционарование пилота и обработкой failsafe и return телеметри ReturnToHome. Нам надо считывать данные с GPS и в то-же время отдавать данные на внешнюю Bluetooth телеметрию

@rotorman
Copy link
Member Author

rotorman commented Aug 23, 2021

@Stinky80 - it would be sweet if you could post in English, so that others can follow as well.

Basically, what you want is to get RM TX16S functionality in T16. Why not just use TX16S mainboard and touchscreen?

This PR tries to offer an easy solution for IMU, without requiring internal hardware modding.

If you are into HW-Mods, have a look at my RCGroups blog post:
https://www.rcgroups.com/forums/showthread.php?3918263-Blog-22-RadioMaster-TX16S-custom-enhanced-mainboard

@rotorman
Copy link
Member Author

@raphaelcoeffic should I merge this PR (double checking)?

@raphaelcoeffic
Copy link
Member

raphaelcoeffic commented Aug 24, 2021

@raphaelcoeffic should I merge this PR (double checking)?

Yep! Approved is "approved" 😊 (i.e. "good to merge")

@rotorman rotorman merged commit 525126e into main Aug 24, 2021
@rotorman rotorman deleted the Horus_I2C_conf branch August 24, 2021 15:05
@wimalopaan
Copy link
Contributor

Wouldn't it be cool to have the values also available as telemetry or inputs?

@wimalopaan
Copy link
Contributor

Just built with the above cmake option. It turns out that the popup for selecting the AUX1 function is completely gone now. I would appreciate if i2c would simply be another selectable option for AUX1. Would that be passible?

@brainbubblersbest
Copy link

Wouldn't it be cool to have the values also available as telemetry or inputs?

This is the case when using the x-lite pro.
You can assign this as Inputs.
If it's possible to change a CPU pin to an alternate fiunction (i2c to Serial) is a Thing you need to ask rotorman.
I like that idea too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants