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

Enable I2C2 bus of auav x21 #8138

Closed
wants to merge 7 commits into from
Closed

Enable I2C2 bus of auav x21 #8138

wants to merge 7 commits into from

Conversation

tubeme
Copy link

@tubeme tubeme commented Oct 16, 2017

Enable the I2C2 bus of auav x2.1. This change came after a MAG registering 3 times on the I2C bus due to messed initialization script on the x21 board.

We slightly moded the board so we could use the I2C2 bus but now there was no initialization of the bus.

Enable the I2C2 bus of auav x2.1. This change came after a MAG registering 3 times on the I2C bus due to messed initialization script on the x21 board.

We slightly moded the board so we could use the I2C2 bus but now there was no initialization of the bus.
@tubeme
Copy link
Author

tubeme commented Oct 16, 2017

@davids5 Remember we made this changes when we were fighting the MAG registering on the I2C bus? #7496 Can you help me make this work? I want to turn on back the I2C2 bus and use it. I cannot compile so I need binary for this change to see how it goes. I really will appreciate it.

@dagar
Copy link
Member

dagar commented Oct 17, 2017

@nkhoit can you review this?

@nkhoit
Copy link
Contributor

nkhoit commented Oct 17, 2017

@tubeme How are you connecting to I2C2? It's not broken out to any header.
I2C2 isn't configured on auav-x21.

@tubeme
Copy link
Author

tubeme commented Oct 17, 2017

@nkhoit we are using a slightly modified board so we made header for the I2C2. It was initialized before #7496. Now it is not.

@dagar
Copy link
Member

dagar commented Oct 17, 2017

We need to be careful with these defines. There are implications for internal/external buses that go beyond arbitrary naming.

 PX4_I2C_BUS_LED		PX4_I2C_BUS_ONBOARD

Is there any LED on the regular auav/mRo x2.1?

@tubeme
Copy link
Author

tubeme commented Oct 17, 2017

@dagar It is not arbitrary. You can see what are the changes introduced in #7496. I just reverse the changes with a small correction. This correction was one the reasons for not proper initialization of I2C thus registering the external Mag hmc5883 registering as 3 devices.

The problem was rather at a different place. in the rc.sensors. Also the line
#define PX4_I2C_BUS_ONBOARD 1
is wrong in the original auav x21 script prior to #7496
it should be
#define PX4_I2C_BUS_ONBOARD 2

the same as in FMUv2 driver script.

The FMUv2 and auav are the same in terms of cpu thus with the same IOs.
auav x2.1 has I2C2 bus it is just not connected to the outside world. But we connected a LED module to see the status (the same way it is connected in the original FMUv2). But it does not work now...

@nkhoit
Copy link
Contributor

nkhoit commented Oct 18, 2017

@tubeme Have you tested if this works on your hardware? I ran it on my X2.1 and nothing seemed too wrong. But it's not easy for me to check if I2C2 works.
I'm pretty sure we'll have to configure the port here as well: https://github.com/PX4/Firmware/blob/master/nuttx-configs/auav-x21/nsh/defconfig#L426

@tubeme
Copy link
Author

tubeme commented Oct 19, 2017

@nkhoit That was my point. I have no way to compile the px4. So if you could share the auav x21 binary that you compiled, I will flash it and test it with my hardware? I will appreciate it. Then I will report back here.

And you are correct we have to edit the file you gave me... Without your proposal it will not enable the I2C2...

@nkhoit
Copy link
Contributor

nkhoit commented Oct 19, 2017

You'll also need to add

#define GPIO_I2C2_SCL    GPIO_I2C2_SCL_1
#define GPIO_I2C2_SDA    GPIO_I2C2_SDA_1
#define GPIO_I2C2_SCL_GPIO \
  (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN10)
#define GPIO_I2C2_SDA_GPIO \
   (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN11)

to https://github.com/PX4/Firmware/blob/master/nuttx-configs/auav-x21/include/board.h
as well.

@nkhoit
Copy link
Contributor

nkhoit commented Oct 23, 2017

Here's a binary file you can upload and try. auav-x21_PR8138.zip

@tubeme
Copy link
Author

tubeme commented Oct 24, 2017

Hey @nkhoit I want to thank you very very much! It works perfect, the LEDs are showing the status :). I tried the firmware to un-moded X21 and it does not create a problem if there is no I2C2 connected. I checked carefully to see if there is going to be a problem with the Mag and Airspeed. Everything is perfect. Can this be added to the master? Otherwise we have to create this custom hack every time there is new version.

@dagar
Copy link
Member

dagar commented Jan 22, 2018

Is this still wanted?

@tubeme
Copy link
Author

tubeme commented Jan 28, 2018

Yes e want this. :)

@dagar
Copy link
Member

dagar commented Jan 28, 2018

Can you verify this is harmless for a regular mRo X21?
@nkhoit

@tubeme
Copy link
Author

tubeme commented Mar 16, 2018

Hello @nkhoit can you please verify if there is no problem with this i2c2 enabled with regular AUAV X2.1 board.

We test it and there are no problems...

Thanks in advance

@tubeme tubeme mentioned this pull request Sep 22, 2018
@stale
Copy link

stale bot commented Jan 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@dagar
Copy link
Member

dagar commented Jan 21, 2019

Is this still needed?

@stale stale bot removed the Admin: Wont fix label Jan 21, 2019
@tubeme
Copy link
Author

tubeme commented Jan 21, 2019

@dagar Yes Daniel if possible?

@davids5
Copy link
Member

davids5 commented Jan 21, 2019

From what I see on the Schematic AUAV_X21_FMU_V2_R01 - 11/10/2017

PB10 is now used as KILL.
PB11 is a no connect.
image

What will happen for the users with something connected to KILL?

@pkocmoud - is the above the "as shipped" Schematic?

@pkocmoud
Copy link
Contributor

@davids5 - That snip is correct for the shipping x2.1

@davids5
Copy link
Member

davids5 commented Jan 21, 2019

@davids5 - That snip is correct for the shipping x2.1

@pkocmoud - Thank you. what it the use case for the signal now (direction and timing, when used) and is there any SW that is supporting it?

@pkocmoud
Copy link
Contributor

@davids5 - It is just a GPIO, the idea was for it to be connected to a power switch to allow the FC to disable the vehicle or deploy a independent recovery device in case of emergency. It did not seem to get much traction.

To the best of my knowledge, nobody has ever used it nor suggested code to enable it.

You can just treat it as an available IO pin.

@dagar
Copy link
Member

dagar commented Feb 6, 2019

Needs to be rebased.

@stale
Copy link

stale bot commented Oct 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

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

Successfully merging this pull request may close these issues.

7 participants