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

drivers for mt7613 #127

Open
bricco1981 opened this issue Dec 29, 2022 · 277 comments
Open

drivers for mt7613 #127

bricco1981 opened this issue Dec 29, 2022 · 277 comments

Comments

@bricco1981
Copy link

bricco1981 commented Dec 29, 2022

hi, thanks a lot for your help with this drivers. I'm try to understand how get drivers for mt7613be chipset, I cannot find any info. I'm talking about mtk and not mt76.should this card work with mt7615 drivers?

@vikingloudmouth
Copy link

any updates on this?
Did you end up working this out @bricco1981

@bricco1981
Copy link
Author

@vikingloudmouth no, i get alot of errors, i stopped now. maybe i''ll start again when i 'll have free time. have you dome progress?

@vikingloudmouth
Copy link

vikingloudmouth commented Oct 15, 2023

@bricco1981 I have tried to use the mt7515 driver. I was able to build the driver with openwrt 22.03.5 and running modprobe on the .ko runs without errors. I can't bring it up though. Using Luci I get the message "Please restart manually to create this interface." when selecting enable - this doesn't change after rebooting the router or pressing the reload button. Looking in the log I have errors

daemon.err uhttpd[1488]: cat: can't open '/tmp/mtk/if-save': No such file or directory
cat: can't open '/tmp/mtk/vifup-save': No such file or directory

I then tried the command line tool /sbin/mtkwifi, first I got a permission error trying to run it. After fixing that with chmod, I can see the same errors that the luci interface generates.

I also tried manually bringing the interface up with
ifconfig rai0 up
but that gives me the error
ifconfig: SIOCGIFFLAGS: No such device

From a quick look at the code for the luci app, it appears to me to all start from the what is returned when running
ls /sys/class/net

For me, I can see ra0 in the output of that command ( I was also trying - without issues - the mt7603 driver), but no rai0 is listed. This is where I got stuck though.

@bricco1981
Copy link
Author

No,mt7615 are not the driver you Need . You Need mt7663.

@vikingloudmouth
Copy link

@bricco1981 Do you know where they are available? I thought the mt7615 driver covered that? (or is that just with the opensource mt76 driver version)

@vikingloudmouth
Copy link

I have been using the mt7663 driver on my mt7613 without any issues for the last week. It was built based on "MT7663_LinuxAP_6.0.3.0_20200106-775e6a.tar" with modifications copied from the mt7615d driver in https://github.com/Azexios/openwrt-r3p-mtk to get it to compile for openwrt 22.03.5.

Does anyone know what need to be changed to use these mtk drivers for use with openwrt 23.05?

@bricco1981
Copy link
Author

so can you share the driver on github? or explain neded modification?

@ravichaudhary133
Copy link

@vikingloudmouth Hey, could you share the process of building the mtk drivers based on mt7663 for mt7613 device. I really need to get it working for my device. The default mt76 driver in openwrt has tx power issues.

@bricco1981
Copy link
Author

@vikingloudmouth can you please share the code, i'm not able to make this work.

@vikingloudmouth
Copy link

vikingloudmouth commented May 8, 2024

I'll share what I have when I have a chance, should find time to dig it back up gain and work out what I did in the next few weeks.

I've been using it since I first posted with only one issue: intermittent reconnection problems when using clients only capable of WPA2 if the router is set to WPA2/WPA3 mixed mode. No issues with clients capable of WPA3, and no issues with WPA2 clients if I don't use the mixed mode and instead only set WPA2 mode. I also have tested it on openwrt 23.05 and the wireless worked fine - the config page wouldn't load though. Hopefully someone else can fix that after I share the code

@ravichaudhary133
Copy link

ravichaudhary133 commented May 8, 2024 via email

@bricco1981
Copy link
Author

ok do not worry about config page i can make that easy. i'll make luci app mtk custom for this.

@bricco1981
Copy link
Author

bricco1981 commented May 28, 2024

FATAL: modpost: GPL-incompatible module mt_wifi.ko uses GPL-only symbol '__kernel_write'
how solve this?
what does this error mean

@bricco1981
Copy link
Author

ping @vikingloudmouth

@bricco1981
Copy link
Author

bricco1981 commented Jul 2, 2024

well as i said i did a custom luci app for this, i do not know if you will share this drivers.
Schermata da 2024-07-02 10-24-48
Schermata da 2024-07-02 10-26-42

@vikingloudmouth
Copy link

Sorry for the lack of response. Left all the code in a mess and haven't got around to working out which of them actually works. Give mt7663.ko with OpenWrt 23.05 a go. I think it should work with

modprobe mt7663
ifconfig rai0 up
brctl addif br-lan rai0

and looks for a /etc/wireless/mt7663/mt7663.2.dat for the config file. Let me know how it goes. It may give only give very slows speeds though, I may need to work out again how I pointed it at the right data for the radio config.

I'll try to find the code that that actually can from. I really should have done this properly from the start...

@bricco1981
Copy link
Author

this is crazy i made the driver work but very low signal, so calibration is not correct. i'll try your mt7663.ko

@vikingloudmouth
Copy link

From memory the part of the code that looks for the firmware .bin file was kinda broken when the radio config was for two cards w.r.t. to using/not using a offset into the calibration area for the second radio in a .bin file was used. Think I ended up working around it be pointing it to a .bin file that contained the calibration data for both radios, setting a offset somewhere in the menuconfig, and making sure that I had it set as the second card with the first card selected as a 7603 (even though I wasn't using the mtk driver for the first card)

Think I also had speed issues at one point if I was running with a default .dat without encryption (or something along those lines) even I using no password on the network

@vikingloudmouth
Copy link

vikingloudmouth commented Jul 3, 2024

If helpful, this is the relevant part of my config

CONFIG_PACKAGE_kmod-mt7603=y
# CONFIG_PACKAGE_kmod-mt7603e is not set
# CONFIG_PACKAGE_kmod-mt7615-firmware is not set
# CONFIG_PACKAGE_kmod-mt7615d is not set
# CONFIG_PACKAGE_kmod-mt7615e is not set
# CONFIG_PACKAGE_kmod-mt7663-firmware-ap is not set
# CONFIG_PACKAGE_kmod-mt7663-firmware-sta is not set
CONFIG_PACKAGE_kmod-mt7663e=y
CONFIG_MTK_MT7663E_SUPPORT_OPENWRT=y
CONFIG_MTK_MT7663E_WIFI_DRIVER=y
# CONFIG_MTK_MT7663E_FIRST_IF_NONE is not set
CONFIG_MTK_MT7663E_FIRST_IF_MT7603E=y
# CONFIG_MTK_MT7663E_FIRST_IF_MT7615E is not set
# CONFIG_MTK_MT7663E_FIRST_IF_MT7622 is not set
# CONFIG_MTK_MT7663E_SECOND_IF_NONE is not set
CONFIG_MTK_MT7663E_SECOND_IF_MT7663E=y
# CONFIG_MTK_MT7663E_SECOND_IF_MT7615E is not set
# CONFIG_MTK_MT7663E_SECOND_IF_MTTEST is not set
CONFIG_MTK_MT7663E_THIRD_IF_NONE=y
# CONFIG_MTK_MT7663E_THIRD_IF_MT7615E is not set
CONFIG_MTK_MT7663E_RT_FIRST_CARD=7603
CONFIG_MTK_MT7663E_RT_SECOND_CARD=7663
CONFIG_MTK_MT7663E_RT_FIRST_IF_RF_OFFSET=0x0
CONFIG_MTK_MT7663E_RT_SECOND_IF_RF_OFFSET=0x8000
CONFIG_MTK_MT7663E_MT_WIFI=y
CONFIG_MTK_MT7663E_MT_WIFI_PATH="mt_wifi"

#
# WiFi Generic Feature Options
#
CONFIG_MTK_MT7663E_FIRST_IF_EEPROM_FLASH=y
# CONFIG_MTK_MT7663E_FIRST_IF_EEPROM_EFUSE is not set
CONFIG_MTK_MT7663E_RT_FIRST_CARD_EEPROM="flash"
CONFIG_MTK_MT7663E_SECOND_IF_EEPROM_FLASH=y
# CONFIG_MTK_MT7663E_SECOND_IF_EEPROM_PROM is not set
# CONFIG_MTK_MT7663E_SECOND_IF_EEPROM_EFUSE is not set
CONFIG_MTK_MT7663E_RT_SECOND_CARD_EEPROM="flash"
CONFIG_MTK_MT7663E_MULTI_INF_SUPPORT=y
CONFIG_MTK_MT7663E_WIFI_BASIC_FUNC=y
CONFIG_MTK_MT7663E_DOT11_N_SUPPORT=y
CONFIG_MTK_MT7663E_DOT11_VHT_AC=y
CONFIG_MTK_MT7663E_G_BAND_256QAM_SUPPORT=y
CONFIG_MTK_MT7663E_TPC_SUPPORT=y
# CONFIG_MTK_MT7663E_THERMAL_PROTECT_SUPPORT is not set
CONFIG_MTK_MT7663E_ICAP_SUPPORT=y
CONFIG_MTK_MT7663E_SPECTRUM_SUPPORT=y
CONFIG_MTK_MT7663E_BACKGROUND_SCAN_SUPPORT=y
CONFIG_MTK_MT7663E_SMART_CARRIER_SENSE_SUPPORT=y
# CONFIG_MTK_MT7663E_SCS_FW_OFFLOAD is not set
CONFIG_MTK_MT7663E_MT_DFS_SUPPORT=y
# CONFIG_MTK_MT7663E_OFFCHANNEL_SCAN_FEATURE is not set
CONFIG_MTK_MT7663E_HDR_TRANS_TX_SUPPORT=y
CONFIG_MTK_MT7663E_HDR_TRANS_RX_SUPPORT=y
CONFIG_MTK_MT7663E_WSC_INCLUDED=y
CONFIG_MTK_MT7663E_WSC_V2_SUPPORT=y
CONFIG_MTK_MT7663E_DOT11W_PMF_SUPPORT=y
CONFIG_MTK_MT7663E_TXBF_SUPPORT=y
# CONFIG_MTK_MT7663E_FTM_SUPPORT is not set
# CONFIG_MTK_MT7663E_MBO_SUPPORT is not set
CONFIG_MTK_MT7663E_IGMP_SNOOP_SUPPORT=y
CONFIG_MTK_MT7663E_RTMP_FLASH_SUPPORT=y
CONFIG_MTK_MT7663E_CAL_BIN_FILE_SUPPORT=y
CONFIG_MTK_MT7663E_LINK_TEST_SUPPORT=y
CONFIG_MTK_MT7663E_WIFI_GPIO_CTRL=y
# CONFIG_MTK_MT7663E_MIN_PHY_RATE_SUPPORT is not set
# CONFIG_MTK_MT7663E_VENDOR_FEATURE11_SUPPORT is not set
CONFIG_MTK_MT7663E_ATE_SUPPORT=y
# CONFIG_MTK_MT7663E_MEMORY_OPTIMIZATION is not set
# CONFIG_MTK_MT7663E_PASSPOINT_R2 is not set
CONFIG_MTK_MT7663E_UAPSD=y
# CONFIG_MTK_MT7663E_TCP_RACK_SUPPORT is not set
CONFIG_MTK_MT7663E_RED_SUPPORT=y
# CONFIG_MTK_MT7663E_FDB_SUPPORT is not set
# CONFIG_MTK_MT7663E_FIRST_IF_EPAELNA is not set
CONFIG_MTK_MT7663E_FIRST_IF_IPAILNA=y
# CONFIG_MTK_MT7663E_FIRST_IF_IPAELNA is not set
# CONFIG_MTK_MT7663E_SECOND_IF_EPAELNA is not set
CONFIG_MTK_MT7663E_SECOND_IF_IPAILNA=y
# CONFIG_MTK_MT7663E_SECOND_IF_IPAELNA is not set
# CONFIG_MTK_MT7663E_RLT_MAC is not set
# CONFIG_MTK_MT7663E_RTMP_MAC is not set
# end of WiFi Generic Feature Options

I am using a .bin file I extracted from by device. not sure exactly what I did to extract it, but the radio calibration data is at offset 0x8000 that matches the above config. You can tell by the first two bytes at that offset being 0x63 0x76 which matches 7663. The first part of my .bin file is for the 7603 radio, so at offset 0 the first two bytes are 0x03 0x76 for 7603.

Hopefully, this help you getting it to find the calibration data


edit: the .bin I'm using comes from saving my radio mtdblock

@bricco1981
Copy link
Author

so when you first fixed the compilation, did the driver worked fine? good speed and signal? or always week?

@vikingloudmouth
Copy link

No I had speed issues initially. Don't think I needed to change the code to fix it though, just the config and point the driver to a .bin file that contained the calibration data at the offset rather than at the start.

From memory, the driver was putting out some messages in one of openwrt logs (think it was the kernel log) about not finding firmware/eeprom/bin data and using a default one.

Also pretty sure I've found the code that works. I'll give it a quick test from a clean start and put it up if it works.

@vikingloudmouth
Copy link

FATAL: modpost: GPL-incompatible module mt_wifi.ko uses GPL-only symbol '__kernel_write'
how solve this?
what does this error mean

You probably already worked this out, but I got around this by changing the mt_wifi code to say it was GPL...

@bricco1981
Copy link
Author

yes i i fixed that. the problem that now i have is wrong macaddress and weak signal in ap mode, in sta mode i get good speed like 300 down 50 up.

@vikingloudmouth
Copy link

If your getting good speeds in sta mode that means you now have it finding the calibration data right?

Try checking your config in AP mode, think I made have also had slows speeds until I setup the .dat file to use encryption (or something along those lines) for the network mode. From memory it wasn't really a problem with the driver, just that devices would only use a slow rate in the outdated default mode without any

@bricco1981
Copy link
Author

well the signal is too weak in ap mode and why i have wrong mac address?

@vikingloudmouth
Copy link

I have no idea about the mac address, I didn't check what it was before and don't know if it is wrong or not for me

@bricco1981
Copy link
Author

bricco1981 commented Jul 4, 2024

for the low signal could be that the antennas are not used the right way. my device is a comfast ew72 v2

@vikingloudmouth
Copy link

Doesn't the good speed in STA mode rule that out?

@bricco1981
Copy link
Author

yes that's very strange. also i do not see about ANTENNA STAFF in bin folder, if you check the bin folder mt7615 you can see antenna things.

@vikingloudmouth
Copy link

you mean the .bin files?

@ravichaudhary133
Copy link

Using radio.bin and renaming it to e2p doesnt restore mac for mt7603..
It still remains the same.

@bricco1981
Copy link
Author

bricco1981 commented Jul 15, 2024

that's a bad news

and the range is still poor?

can you check if your radio.bin start with mt7603 or mt7663?

that's strange for me mt7603 are ok too.

@ravichaudhary133
Copy link

Yes, the range is remains poor as hell!

Does mt7603 also look for e2p from /lib/firmware?

@ravichaudhary133
Copy link

What if i delete e2p from /lib/firmware? Will both mt7663 and mt7603 have poor str?

@ravichaudhary133
Copy link

Also, can i compile openwrt stock mt7603 along with proprietary together to choose between two?

@bricco1981
Copy link
Author

try, you have the device it's a good test. for mt7603 i have an idea. do this test with and without e2p

@ravichaudhary133
Copy link

Alright, i am waiting for a new build, as i didnt include the desired modules earlier.

@ravichaudhary133
Copy link

Btw, we cannot install kernel modules from opkg because of kernel hash mismatch, any solution for that?!

@bricco1981
Copy link
Author

just build it in kernel.

@bricco1981
Copy link
Author

i asked you if your bin start with mt7603 or mt7663

@ravichaudhary133
Copy link

ravichaudhary133 commented Jul 15, 2024

Btw, from where is the e2p file in /lib/firmware generated after flashing the firmware for the first time.

Is it auto generated while building the firmware or is device specific and is just a copy of radio.bin?

@ravichaudhary133
Copy link

i asked you if your bin start with mt7603 or mt7663

It will take another 5-10mins for the build man, sorry for the delay.

@ravichaudhary133
Copy link

Also, can i compile openwrt stock mt7603 along with proprietary together to choose between two?

Alright, the build failed with both mt7603 enabled.

@bricco1981
Copy link
Author

bricco1981 commented Jul 15, 2024

Btw, from where is the e2p file in /lib/firmware generated after flashing the firmware for the first time.

Is it auto generated while building the firmware or is device specific and is just a copy of radio.bin?

is generated like you did in luci, but this come from a partition called factory. and it will be installed. makefile mt_wifi

but it will not install i disabled in makefile

@ravichaudhary133
Copy link

Btw, from where is the e2p file in /lib/firmware generated after flashing the firmware for the first time.
Is it auto generated while building the firmware or is device specific and is just a copy of radio.bin?

is generated like you did in luci, but this come from a partition called factory. and it will be installed. makefile mt_wifi

but it will not install i disabled in makefile

Will enabling it help mt7603 to get better?

@bricco1981
Copy link
Author

i'm asking your bin start with mt7603 or mt7663?

@ravichaudhary133
Copy link

Wait a sec..

e2p.txt
Here it is, please rename it to e2p.bin

Hex editor doesnt show much in text.

@ravichaudhary133
Copy link

Any suggestions?!

@bricco1981
Copy link
Author

try this is should not work but i need make sure.
rename your bin MT7603E.bin and use it in /etc_ro/wlan/

@ravichaudhary133
Copy link

try this is should not work but i need make sure. rename your bin MT7603E.bin and use it in /etc_ro/wlan/

No change in mac and signal strength.

@bricco1981
Copy link
Author

try this in /etc_ro/wlan/
MT7603E.zip

@ravichaudhary133
Copy link

Everything stays the same.

@bricco1981
Copy link
Author

bricco1981 commented Jul 15, 2024

rename the bin i just sented e2p and use it in lib/firmware and in /etc_ro/wlan/ find out

@ravichaudhary133
Copy link

Man,really sorry for the delay, will get back to you in 5 mins.

@ravichaudhary133
Copy link

Something strange,

When i used my default radio.bin as MT7603E.bin in /etc_ro/wlan, the default mac address came up but signal str is even poor.

But when i use the bin you provided and place it in /etc_ro/wlan, signal str restores to almost that of stock but mac changes to something diff, with multiple zeros in between.

@ravichaudhary133
Copy link

Finally, it is fixed now, both mt7663 and mt7603 works like stock.

Flashed full tplink stock firmware> booted intramfs> took backup of stock radio.bin> flashed new openwrt> used that radio.bin in /lib/firmware as well as /etc_ro/wlan/

Mac addresses on both the interfaces are stock ones!!

@ravichaudhary133
Copy link

Thanks a lot legend @bricco1981 !!

@ravichaudhary133
Copy link

If you need any help related to the drivers, please let me know!! Thanks again @bricco1981 and @vikingloudmouth !!

@ravichaudhary133
Copy link

find this setting is in alfabetical order and try the difference MUTxRxEnable=1 MUTxRxEnable=2 MUTxRxEnable=3 do not warry we will check later if for you the signal is max. now check for speed.

Btw, stock tplink radio.bin configures it as MUTxRxEnable=1

@bricco1981
Copy link
Author

Finally, it is fixed now, both mt7663 and mt7603 works like stock.

Flashed full tplink stock firmware> booted intramfs> took backup of stock radio.bin> flashed new openwrt> used that radio.bin in /lib/firmware as well as /etc_ro/wlan/

Mac addresses on both the interfaces are stock ones!!

nice idea, i need ask you some info, not now, we will continue.

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

No branches or pull requests

3 participants