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

chore(gx12): add Bluetooth pin definitions #5876

Merged
merged 4 commits into from
Feb 17, 2025
Merged

Conversation

Doncuppjr
Copy link
Contributor

@Doncuppjr Doncuppjr commented Feb 7, 2025

Summary of changes:

  • Disable serial if bluetooth is enabled
  • Create pin definitions for bluetooth on GX12

Okay, looks like I have to pick different pins for the GX12, even though USART3 is defined.

I can browse and find the slave BT device, but I can't confirm it or exit the discover menu.

	modified:   radio/src/targets/taranis/CMakeLists.txt
	modified:   radio/src/targets/taranis/hal.h
…X12"

This reverts commit d9773a5.

	modified:   radio/src/targets/taranis/CMakeLists.txt
	modified:   radio/src/targets/taranis/hal.h
	modified:   radio/src/targets/taranis/CMakeLists.txt
	modified:   radio/src/targets/taranis/hal.h
@Doncuppjr
Copy link
Contributor Author

Something is not quite right yet. A master that is already paired works, but can't pair with new devices.

@Doncuppjr Doncuppjr closed this Feb 8, 2025
@pfeerick
Copy link
Member

pfeerick commented Feb 8, 2025

Probably better to leave this open for now, but marked as a draft. Can you keep a running log of what its and isn't working so far, so don't need to filter through the chat in discord to see the status of the PR ;)

@pfeerick pfeerick reopened this Feb 8, 2025
@pfeerick pfeerick marked this pull request as draft February 8, 2025 23:01
@Doncuppjr
Copy link
Contributor Author

Doncuppjr commented Feb 8, 2025

What's working:
Local BT adapter is seen by the radio
Can view local address
Can scan for slaves
An already paired device will connect
Trainer channels are correctly received and used by the radio

What's not:
Can not confirm attachment to new slaves
Can not exit discovery

@pfeerick
Copy link
Member

pfeerick commented Feb 8, 2025

what is BT_EN_GPIO

What BT module are you using? As in addition to TX/RX there is usually an enable pin, that soft turns the bluetooth "module" on or off.

Nice... making some progress already though :)

@Doncuppjr
Copy link
Contributor Author

I'm using the Horus para adapter. I've wired it up through a vreg to reduce voltage to 3.3. Only TX/RX plus power are connected. Same adapter worked perfectly on RM Boxer, which only had those pins. When I transplanted the adapter, it preserved the pairings, and I was greeted with a "Trainer Connected" message after setting up the pins for the GX12. Upon updating my config from companion, pairings were cleared, and I can not make a new pairing.

@Doncuppjr
Copy link
Contributor Author

Doncuppjr commented Feb 8, 2025

I'm wondering if this is really BT related, or something else with EdgeTX. Why would the 'Exit/Return' and 'Enter' buttons stop working in the discovery dialog? The radio is not locked, as I can continue to scroll through the slaves even after attempting a selection, but I can never confirm or leave the dialog.

@pfeerick
Copy link
Member

pfeerick commented Feb 9, 2025

Possibly... the state machine for bluetooth handling could be getting stuck if the BT module isn't responding the way it expects, and the UI unable to continue (although it seems like it should have some fault tolerance around that)... and it seems like from the looks of that code that BT_EN_GPIO isn't defined, so it's not like the code is expecting it to be present and getting stuck that way. BT_PWR_GPIO is another one, but that has only been defined for the TX16S

PD.8 and PD.9 are correct per the schematic, and the boot pin on that header is linked to PA.06 via a NPN transistor. Might be worth defining BT_EN_GPIO also, and see if that changes anything.

PD.08 - AUX3_TX
PD.09 - AUX3_RX
PA.06 = AUX3_BOOT

@Doncuppjr
Copy link
Contributor Author

Doncuppjr commented Feb 9, 2025

Something like,

@@ -2829,20 +2829,25 @@
   #elif defined(PCBX9LITES)
     #define BT_EN_GPIO                  GPIO_PIN(GPIOD, 14) // PD.14
   #elif defined(MANUFACTURER_RADIOMASTER)
-    #if defined(RADIO_POCKET)
+    #if defined(RADIO_POCKET) || defined(RADIO_GX12)
       #define BT_EN_GPIO                GPIO_PIN(GPIOA, 6) // PA.06
     #endif
   #else
     #define BT_EN_GPIO                  GPIO_PIN(GPIOE, 12) // PE.12
   #endif

@pfeerick
Copy link
Member

pfeerick commented Feb 9, 2025

Yup, that looks good. No need to duplicate :)

@Doncuppjr
Copy link
Contributor Author

No joy. I'm sure it's more correct now that the pin is defined, but still no confirm, no exit.

@Doncuppjr
Copy link
Contributor Author

Doncuppjr commented Feb 9, 2025

I managed to get some logging enabled for bluetooth to the internal storage, not really sure what to make of it. I also noted that once I get locked into the discover UI, plugging in a usb cable just makes the radio do a pulsing beep, and the USB mode UI doesn't come up. Only power cycling gets me back to functional. I'll attach a log. There are some successful connections, but those are only after I move the adapter to a boxer, pair and then move it back.
bluetooth.log

@Doncuppjr
Copy link
Contributor Author

So whatever the issue is, it's not local to the GX12. I just did a build from the same checkout for the Boxer. It's exhibiting the exact same behavior as the GX12.
Can't confirm a slave.
Can't exit the dialog.

@Doncuppjr Doncuppjr marked this pull request as ready for review February 10, 2025 03:12
@Doncuppjr
Copy link
Contributor Author

This PR is only what it claims to be, modifications to enable BT on GX12. Mostly pin assignments. However, BT is broken in 2.11, this does not fix that.

@Doncuppjr
Copy link
Contributor Author

In conjunction with #5918, this looks to give BT to the GX12.

@pfeerick pfeerick changed the title Update configuration of bluetooth on GX12 chore(gx12): add Bluetooth pin definitions Feb 17, 2025
@pfeerick pfeerick added this to the 2.11 milestone Feb 17, 2025
@pfeerick pfeerick merged commit b8f1557 into EdgeTX:main Feb 17, 2025
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants