[PYBD_SF2] Implementing an option to change to external antenna on bluetooth module #12368
-
Hi guys :) 👋🏻 import network
wl = network.WLAN(1)
wl.config(antenna = 1)
wl.activate(1) # <- seems really wasteful to activate the wifi module just to use the external antenna on the BT module even though the switch should be made by just changing an GPIO state (WL_GPIO_1 connected to the RF switch). switch (mp_obj_str_get_qstr(e->key)) {
case MP_QSTR_antenna: {
uint8_t buf[4];
nw_put_le32(buf, mp_obj_get_int(e->value));
cyw43_ioctl(self->cyw, CYW43_IOCTL_SET_ANTDIV, 4, buf, self->itf);
break;
} is basically impossible without instantiating a self object of type |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
@jotamudo I will check with Damien, but I think that to drive this GPIO pin, the WiFi interface needs to be active anyway (because it's the WiFi interface on the cyw43 that controls the GPIO). In other words, you could put this code elsewhere, but It's not particularly wasteful - activating the interface doesn't cost any RAM, and you can also set the |
Beta Was this translation helpful? Give feedback.
-
The antenna handling is a little complicated. Basically there are two options:
I think option 2 is exactly what you want. To select the external antenna do:
It's input mode in case the CYW4343 itself tries to drive that line. Pull up selects the external antenna path. Pull down will select the on-board chip antenna. You must run that code after activating the BLE interface. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
The antenna handling is a little complicated. Basically there are two options:
CYW43_IOCTL_SET_ANTDIV
ioctl is used for, to enable antenna diversity.I think option 2 is exactly what you want. To select the external antenna do:
It's input mode in case the CYW4343 itse…