Xinyuan-LilyGO / T-Halow

32 stars 1 forks source link

Flash chip comes pre-flashed with firmware? #14

Open abu-matterize opened 1 week ago

abu-matterize commented 1 week ago

Hello there,

I brought T-Halow and tried to communicate with TX-AH module via AT commands with microUSB port. But failed.

Do I need to flash the firmware to do so? Or is there a way I can communicate via ESP32 out of the box?

abu-matterize commented 1 week ago

After USB-C is plugged - Solid green light. Opening JTAG port with 115200 prints,

[369424]send assoc request to 22:9f:f1:a2:8d:28, ssid= (freq:8660)
+DISCONNECT
******************************
TX-AH   PASS
SSD1306  ---
SDCard   ---
CAMERA   ---

Role:          STA 
Disconnect!!!

[372870]send assoc request to 22:9f:f1:a2:8d:28, ssid= (freq:8660)
[373232]send assoc request to 22:9f:f1:a2:8d:28, ssid= (freq:8660)
[374714]send assoc request to 22:9f:f1:a2:8d:28, ssid= (freq:8660)
+DISCONNECT
******************************

But no activity on the FTDI port. AT+MODE? returns nothing.

alphafox02 commented 1 week ago

Please refer to this video I put together. Since you’ve mentioned micro usb port I am making the assumption you have the older hardware.

Not all applications open and communicate correctly with the micro usb port which is what you need to connect to for the purposes of sending AT commands. You can likely find the windows version of this application and follow along as needed, but I used Linux.

https://www.youtube.com/watch?v=vZjUTUHTOX4

abu-matterize commented 1 week ago

The label in the hardware says: T-Halow V1.0 24-05-31

abu-matterize commented 1 week ago

Now the microUSB port prints,

** hgSDK-v1.6.4.3-29063, app-0, build time:Aug  5 2024 14:48:50 **
[5]MCLR occured!
[8]syscfg_read OK!
[2009]test_temperature=36
[2013]rf init 860M...
[2019]bios_id=0xa
[2020]xtal_id=1
[2021]SMT_DAT: 24012302
[2023]use UUID for MAC
[2035]IP101GR phy two led mode 
[2040]tx_pwr= 20 max= 20 dBm
[2041]ac= 0 aifs= 3 cw_min= 15 cwmax= 127 txop= 0
[2045]ac= 1 aifs= 7 cw_min= 15 cwmax= 127 txop= 0
[2050]ac= 2 aifs= 2 cw_min= 7 cwmax= 127 txop= 0
[2054]ac= 3 aifs= 2 cw_min= 3 cwmax= 63 txop= 0
[2059]DCDC_1P3V: Disable
[2061]No dcfg
[2062]check wk_reason:0
[2065]WNB init: bus type:3
[2067]  BSS_BW :2
[2069]  MAX_STA:8
[2071]  Encrypt:1
[2072]  ROLE   :sta
[2074]  Beacon_Interval:500mS
[2077]  Heartbeat_Interval:500mS
[2080]  MAX_IDLE:300S
[2082]  APLOST_TIME:10S
[2084]not paired, enter idle
[8088]

I've 2 device, one with flash chip replaced which came in the box.

abu-matterize commented 1 week ago

And it's print,

cca: 4s st12= 0:0 mid1224= 0:0:0:0 ed1224= 0:0:0:0 ch_bz= 0
chip-temperature:47, vcc:3.30, vdd13b:1.34, vdd13c:1.33
sta_list: no sta

every 2 seconds.

alphafox02 commented 1 week ago

Yep, use the chips provided that came in separate bags. I can’t speak to the hardware confidently as you’re mentioning you have a micro usb port. I have two hardware models, the older ones that had micro usb and usbc ports and newer hardware that has just usbc port but also has a mode switch for ap/sta and a pair button.

If you’re now seeing output like you’ve shown above on the micro usb port, you should be able to issue AT commands.

alphafox02 commented 1 week ago

If you’re simply trying to use them to setup a wireless bridge mode, meaning you can plug a laptop into each one and be able to ping from laptop to laptop, then check out the video I shared. You should be able to give AT commands to make one an AP and one a STA and then initiate a pairing process once. Once complete, you’ll be able to communicate across.

If you’re trying to setup one of the other modes, you’ll have to refer to the info lilygo provided. I’ve only focused on bridge mode so far.

abu-matterize commented 1 week ago

Here it is. T-Halow

abu-matterize commented 1 week ago

I'm looking to get the AT commands working initially.

alphafox02 commented 1 week ago

Yep, I have that version too - just the 900mhz one instead. The video and steps I mention above should assist you assuming there’s no problems with the chips you inserted. Pay super close attention to the markings and dot on them as I accidentally briefly put one in to the seat incorrectly. Since you’re seeing output on micro usb you of course have if in correct.

abu-matterize commented 1 week ago

I'm using picocom, I tried with serialportassistant as well, but the results are same.

abu-matterize commented 1 week ago

I've 2 devices, one replaced flash chip came with bag and another as it's out of box. The log is only printed from the flash swapped device.

alphafox02 commented 1 week ago

Each device should’ve came with a chip in a bag, based on my knowledge of the older devices like you have.

You need to replace the flash chip of each one with the chip in the bag.

Then perform the steps according to lilygo images or my video.

I don’t see in any of your screen shots above where you are issuing AT commands.

abu-matterize commented 1 week ago

Okay. I replaced flash chips for both devices. Here is the command I've issued and received no response.

*** local echo: yes ***
AT+MODE?
[62723]
LMAC STATUS:
local: 22:9f:f1:9c:9e:40 AID= 0
freq= 866.0 bw=2 chn=3 bgr=-60 iq=0:50:-1:0 dc=0:0(7:-1) tx=*5 dly=64:0:0 sif:rsp=0:0(0)
chn:  866.0 
bgr:    -60 
buf: free=78 tq=0 sq=0 ac=0:0:0:0 agg=0:0:0:0 statq=0 rxq=0:0 skb=0:0 rxb=120K
irq: ac=0 bkn=0 bo(rts:frm)=0:0:0:0:0 to(rts:frm)=0:0 rx=15
tx : cnt=0 dly=0:0ms mcast(bw:mcs)=2:0 agg=0(6027,0:0) data=0KB(0kbps) dur=0ms cca=0 per=0% est_rate=0kbps fail=0 drop=0
rx : cnt=15 bus=0ms cts_bm=0:0 pks=15 data=1KB(1kbps) dur= 6ms err(phy:fcs)=0:0 ecode=0x0 rssie= 0:0 cache_rxq= 0:0
dbg: dtmd=0:0:0 stamap=0x0 sleepmap=0x0 flag=0x0 rxdp=0 kerr=0 mic=0 lerr=0 kick=0 csc=0 rst=0 ovf=0 nob=0 tsnr=0 rssi=0 rxdut=0% txp=0 rxg=5    
cca: 4s st12= 0:0 mid1224= 0:0:0:0 ed1224= 0:0:0:0 ch_bz= 0
chip-temperature:45, vcc:3.31, vdd13b:1.31, vdd13c:1.31
sta_list: no sta
alphafox02 commented 1 week ago

AT+WNBCFG

abu-matterize commented 1 week ago
AT+WNBCFG+WNBCFG (0) OPEN
    role:sta, bss_bw:2, encrypt:1, forward:1, key_set:0, mkey_set:0, join_group:0, bssid_set:0
    freq_range:0~0
    chan_list: 8660,
    ssid:, r_ssid:, addr:22:9f:f1:9c:9e:40
    max_sta:8, tx_mcs:255, acs_enable:1, acs_tmo:0, tx_bw:2
    country_region:, tx_power:20, pri_chan:3
    psconnect_period:60, psconnect_roundup:4
    wkio_mode:0, psmode:0, wait_psmode:0, auto_chsw:0, acktmo:0
    bss_max_idle:300, beacon_int:500, dtim_period:2
    group_aid:0, agg_cnt:0, aplost_time:10, roam_rssi_th:-60, roam_int:5, roam_rssidiff:12
    dhcpc_en:0, dhcp_host:, ack_tmo:0, reassoc_wkhost:0, mcast_filter:0
    auto_role:0, roaming:0, dupfilter:1, pa_pwrctrl_dis:0, pair_autostop:0, supper_pwr:1, mac_set:0
    not_auto_save:0, dcdc13:0, auto_pair:0, heartbeat_int:500, auto_sleep_time:0, wkup_io:0, wkio_edge:0
    ap_psmode:0, dis_1v1_m2u:0, psconnect_dis:0, ap_hide:0, roaming_samefreq:0, max_txcnt:7, repeater_level:1
    mcast_txmcs:0, mcast_txbw:0, mcast_clearch:0, mcast_dupcnt:0
    wkup_host_reason:2,3,4,9,11,8,7,12,14,
abu-matterize commented 1 week ago

Okay. Seems like AT command is responding.

alphafox02 commented 1 week ago

Yep that shows you it’s working. If you refer to the video I linked you to it shows you all the steps or issue the commands per the documentation.

For example on 1 AT+MODE=AP

on 2 AP+MODE=STA

on both while leaving both powered AT+PAIR=1

look for successful pair then on both AT+PAIR=0

abu-matterize commented 1 week ago

The behaviour is related to picocom it seems. When I copy paste and hit return, AT command responds, but when I type it in, no response.

alphafox02 commented 1 week ago

You can then plug one into your home router, for example, and plug your laptop into another. If everything is working, you should get DHCP from your home router.

alphafox02 commented 1 week ago

The behaviour is related to picocom it seems. When I copy paste and hit return, AT command responds, but when I type it in, no response.

Interesting, yeah I use what I showed in the video as that worked great for me.

abu-matterize commented 1 week ago

Alright. It's paired.

STA0: 22:9f:f1:73:52:40
tx0: mcs=*1 bw=2MHz snr=54 cnt=16 agg=1 data=1KB(2kbps) dur=11ms dut=50% txq=0 cca=102 ack=1KB(16) drop=0KB(0) per= 0%
rx0: mcs=0 bw=2MHz evm(avg:std)=0:0 rssi=-13 agc=0 cnt=27 agg=1 data=1KB(2kbps) dur=11ms dut=49% fcsErr=0, freqDev=-381Hz adv_bw=0:0:0:0
abu-matterize commented 1 week ago

By the way, does it required to append CR LF at the end? What's the raw frame looks like?

alphafox02 commented 1 week ago

Not sure, I’ve not used more advanced commands/setup yet.

abu-matterize commented 1 week ago

Thanks for your help man.

abu-matterize commented 1 week ago

Interestingly, it's not pasted and hit return. Once pasted - it response back.

abu-matterize commented 1 week ago

Just a quick question @alphafox02 - Did you managed to work with WiFi STA and AP mode building a bridge instead of the Ethernet connections?

alphafox02 commented 1 week ago

Please explain more.

I was mainly focused on the bridge from AP to STA or STA AP STA and being able to have devices plugged in via Ethernet communicate across. In those configurations things have worked. But in both configurations, the bridge is built across the Halow wireless bridge.

I’ve also tested multiple pairs on drones, but that gets a little more complicated.

abu-matterize commented 1 week ago

Here is my thought. I'm planning to setup first t-halow (TX-AH) as an AP and the same as an WiFi AP. And the second t-halow (TX-AH) as an STA with WiFi AP.

If I connect first WiFi AP to device 1 and second WiFi AP to device 2 and assign IP address, will I be able to ping each other?

abu-matterize commented 1 week ago

Setting this will make the esp32 as STA and join to the network? https://github.com/Xinyuan-LilyGO/T-Halow/blob/master/docs/AT_cmd.md#atssid