rk3188+gps模組的調試
發表時間:2020-10-19
發布人:葵宇科技
浏覽次數:71
該驅動(dòng)比較簡單,gps模組是基于uart的自力模塊,rk3188經由過程gpio控制gps(打開與封閉),然後将gps uart的NMEA data接收,并傳遞給上層(gpstest.apk)。
1. gps 模組gpio的┞菲握: gps vcc_en,gps_reset pin的定義:
platform_device :
#if defined(CONFIG_RK29_GPS)
#include "../../../drivers/misc/gps/rk29_gps.h"
#define RK29_GPS_POWER_PIN RK30_PIN1_PB5
#define RK29_GPS_RESET_PIN RK30_PIN0_PD5
int rk29_gps_power_up(void)
{
int ret;
printk("%s \n", __FUNCTION__);
ret = gpio_request(RK29_GPS_POWER_PIN, NULL);
if (ret != 0) {
gpio_free(RK29_GPS_POWER_PIN);
printk("gps power error\n");
return -EIO;
}
//gpio_pull_updown(RK29_GPS_POWER_PIN, PullEnable);
gpio_direction_output(RK29_GPS_POWER_PIN, GPIO_HIGH);
return 0;
}
int rk29_gps_power_down(void)
{
printk("%s \n", __FUNCTION__);
//gpio_request(RK29_GPS_POWER_PIN, NULL);
gpio_direction_output(RK29_GPS_POWER_PIN, GPIO_LOW);
return 0;
}
int rk29_gps_reset_set(int level)
{
gpio_request(RK29_GPS_RESET_PIN, NULL);
if (level)
gpio_direction_output(RK29_GPS_RESET_PIN, GPIO_HIGH);
else
gpio_direction_output(RK29_GPS_RESET_PIN, GPIO_LOW);
return 0;
}
struct rk29_gps_data rk29_gps_info = {
.power_up = rk29_gps_power_up,
.power_down = rk29_gps_power_down,
.reset = rk29_gps_reset_set,
.uart_id = 3,
};
struct platform_device rk29_device_gps = {
.name = "gps",//.name = "rk29_gps",
.id = -1,
.dev = {
.platform_data = http://www.sjsjw.com/100/000185MYM009209/&rk29_gps_info,
}
};
#endif
在體系中(zhōng)添加該device
static struct platform_device *devices[] __initdata = http://www.sjsjw.com/100/000185MYM009209/{
.....
//add liuxd 20141231
#if defined(CONFIG_RK29_GPS)
&rk29_device_gps,
#endif
.......
};
/kernel/driver/misc/gps/下(xià)面添加gps driver:
注冊成功後/dev/gps結點會生成,下(xià)文(wén)的gps.default.so可(kě)以經由過程/dev/gps打開與封閉gps。
2.rk3188 uart3的打開。
2.1打開gps uart3的config
2.2包管 uart3所複竽暌姑的gpio 在軟件裡被初始化為uart func pin.
2.3 chmod 777 /dev/ttyS3
如(rú)不雅此時成功,就可(kě)以用串口助手攫取到gps 的nmea 數據了。
3.在gps在hal層添加gps.default.so
struct hw_module_t HAL_MODULE_INFO_SYM = {
.tag = HARDWARE_MODULE_TAG,
.version_major = 1,
.version_minor = 0,
.id = GPS_HARDWARE_MODULE_ID,
.name = "QUECTEL GPS Module",
.author = "Joe.Wang",
.methods = &gps_module_methods,
};
4.app下(xià)安裝gpstest.apk
5.收星測試。