Hardware platform: S3c6410
Operating system: Android
Network card chip: GH381 (SDIO interface sdio8688)
1. SDIO driver
Because it is an SDIO interface, please make sure that the mmc driver (code in "kerneldriversmmc") can work properly. This is usually involved when debugging flash. It is not a big problem. Because the S3c6410 platform has 3 HSMMCs, you need to confirm which one the SDIO interface of the network card is connected to according to the hardware schematic diagram. When I debugged, it was HSMMC1. The modifications involved in HSMMC1 are
① "kernelarcharmconfigssmdk6410_android_deconfig":
CONFIG_S3C_DEV_HSMMC1=y
CONFIG_S3C6410_SD_CH1=y
②"kernelarcharmmach-s3c6410Kcofnig":
select S3C_DEV_HSMMC1
③"kernelarcharmmach-s3c6410mach-smdk6410.c":
#ifdef CONFIG_S3C6410_SD_CH1
&s3c_device_hsmmc1,
#endif
Note: Currently, the power-on part of the network card is temporarily placed on the MMC initialization pin, and will be moved to other places later.
2. Network card driver
The network card driver is usually provided by the chip manufacturer. If you can get the source code, you must first ensure that it can be compiled. The compiled driver of GH381 is named sd8xxx.ko.
After the driver can be compiled, it is loaded in two steps:
1) Put the driver and firmware into the system.
Generally, a directory is created under the "eclairvendorsec_proprietary" directory and the driver and firmware files are placed in it.
Then copy the file to the corresponding directory of the device in Android.mk, such as:
PRODUCT_COPY_FILES += $(LOCAL_PATH)/helper_sd.bin:system/etc/firmware/mrvl/helper_sd.bin (firmware file)
PRODUCT_COPY_FILES += $(LOCAL_PATH)/sd8688.bin:system/etc/firmware/mrvl/sd8688.bin (firmware file)
PRODUCT_COPY_FILES += $(LOCAL_PATH)/sd8xxx.ko:system/lib/modules/sd8xxx.ko (driver file)
2) System call driver, driver download firmware
Because the network card driver's interface to the upper layer is implemented through the wpa_supplicant middle layer, it is also necessary to ensure that the wpa layer can correctly identify the network card.
The code modifications involved are:
①"eclairhardwarelibhardware_legacywifiwifi.c"
#define WIFI_DRIVER_MODULE_PATH "/system/lib/modules/sd8xxx.ko" //Full path of driver file
#define WIFI_DRIVER_MODULE_NAME "sd8xxx" //This name is the module name, which is used to call when turning off WIFI. It is usually the same as the name of the ko file
#define WIFI_TEST_INTERFACE "mlan0" // "sta" (This name is written according to the name of the network card, but I personally feel that sta should be used)
Note: This modification ensures that the corresponding driver can be found when starting wifi
②"eclairvendorsecsmdk6410AndroidBoard.mk"
BOARD_WPA_SUPPLICANT_DRIVER := WEXT
Note: This modification ensures that wpa_supplicnat can be compiled into the system normally (see the compilation conditions at the beginning of "externalwpa_supplicantAndroid.mk")
③"eclairvendorsecsmdk6410init.rc"
# give system access to wpa_supplicant.conf for backup and restore
mkdir /system/etc/wifi 0770 wifi wifi
chmod 0770 /system/etc/wifi
chmod 0660 /system/etc/wifi/wpa_supplicant.conf
chown wifi wifi /system/etc/ wifi/wpa_supplicant.conf
#wpa_supplicant control socket for android wifi.c (android private socket)
mkdir /data/misc/wifi 0777 wifi wifi
mkdir /data/misc/wifi/sockets 0777 wifi wifi
mkdir /data/system/wpa_supplicant 0777 wifi wifi
chmod 0777 /data/misc/wifi
chmod 0777 /data/misc/wifi/wpa_supplicant.conf
chown wifi wifi /data/misc/wifi
chown wifi wifi /data/misc/wifi/wpa_supplicant.conf
mkdir /data/misc/dhcp 0777 dhcp dhcp
chmod 0777 /data/misc/dhcp
chmod 0777 /system/etc/dhcpcd
chmod 0777 /system/etc/dhcpcd/dhcpcd-run-hooks # The permissions of dhcpcd-run-hooks must be set, otherwise the DHCP service will not work properly.
chown dhcp dhcp /data/misc/dhcp
chown dhcp dhcp /system/etc/dhcpcd
chown dhcp dhcp /system/etc/dhcpcd/dhcpcd-run- Hooks
on boot#Note that the directory creation and permission setting parts must be placed before on boot, and the service setting interface startup part must be placed after. Otherwise, there will be no /data/misc/dhcp directory, and the dhcp service will not work.
service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -imlan0-c /system/etc/wifi/wpa_supplicant.conf
#socket wpa_mlan0dgram 660 wifi wifi
#group system wifi inet
disabled
oneshot
service dhcpcd /system/bin/dhcpcd -f /system/etc/dhcpcd/dhcpcd.conf -dmlan0
#group system dhcp wifi
disabled
oneshot
setprop wifi.interface "mlan0"
setprop wlan.driver.status "ok"
setprop wlan.interface "mlan0"
Note: The red part mlan0 is the name of the network card set by the network card driver. This part of the code can be found in the wlan_add_card() function of the driver code:
if (dev_alloc_name(dev, "mlan%d") < 0) {
PRINTM(ERROR, "Could not allocate device name!n");
goto err_kmalloc;
}
③"eclairexternalwpa_supplicantwpa_supplicant.conf"
update_config=1
//ctrl_interface=mlan0 This part should be a special definition for Android, but it seems to be wrong to use it, so use the following general unix settings
ctrl_interface=DIR=/data/misc/wifi/wpa_supplicant GROUP=wifi
ap_scan=1 #It is best to set it to 1, otherwise the AP may not be found.
Current status: WIFI can be successfully turned on and the surrounding APs can be searched. There are still problems with the connection part. We will continue to debug. 2011.2.11 16:30
-------------------------------------------------- -------------------------------------------------- ---
Problems encountered and solutions:
1. When connecting to AP, an error occurs when running the following code
Wlan_wmm.c wmm_process_app_iface_tx{
...
atomic_inc(&Adapter->wmm.packetsQueued);//There is an error here
...
}
The error is as follows:
Alignment trap: not handling instruction e1930f9f at [
Unhandled fault: alignment exception (0x001) at 0xc98ac0b2 //Calibration error
Solution:
Add variables to the wmm structure so that the entire structure is an integer multiple of 4 bytes before packetsQueued
typedef struct
{
u8 required;
u8 enabled;
u16 tmp;//This is an additional addition to ensure that there are 4 bytes before packetsQueued
atomic_t packetsQueued;
...
}__ATTRIB_PACK__ WMM_DESC;
Currently, this solution is only for error prompts. The root cause may also be problems with compilation parameters and other settings, which will be analyzed later.
Current status: Can successfully connect to AP, but fails to obtain AP address afterwards, probably because there is a problem with the DHCP server settings.
-------------------------------------------------- -------------------------------------------------- --------------------------
Failed to obtain the IP address. Possible reasons are as follows:
1. The DHCP service is not started, or does not work properly after starting. Please refer to the content added in the previous "eclairvendorsecsmdk6410init.rc".
2. The network card interface in the DHCP code is wrong. Please check the function in the file "eclairframeworksbasewifijafaandroidnetwifiWifiStateTracker.java":
public WifiStateTracker()
{
...
mSettingsObserver = new SettingsObserver(new Handler());
mInterfaceName = SystemProperties.get("wifi.interface", "mlan0" ); //"tiwlan0"); The default network card name here is tiwlan0, which needs to be changed to the one we use
sDnsPropNames = new String[] {
"dhcp." + mInterfaceName + ".dns1",
"dhcp." + mInterfaceName + ".dns2"
};
...
}
At present, WIFI can normally connect to unencrypted AP hotspots, successfully obtain IP addresses, open web pages, and turn on and off normally.
Previous article:Tiny 6410 key interrupt driver notes
Next article:LCD of the core bus, frambuffer (sb)
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- consult
- MSP430 timer is set to 1S
- Wi-Fi in 2025: It might be watching your every move
- Please tell me about low noise broadband op amp
- Keil development environment construction
- MSP430 MCU GPIO Demonstration Program
- Which teacher would like to talk about CPL?
- Live review: Infineon BMS solutions protect electric vehicles and energy storage systems!
- How does MSP430FR6972 achieve the lowest power consumption for LCD driving?
- There is no impetuous advertising here. I like this forum.