初学者
10 分钟

使用SIM33ELA和STM32F031K6自信导航

迷失在冒险中,而不是方向

GNSS 3 Click with Nucleo 32 with STM32F031K6 MCU

已发布 10月 01, 2024

点击板

GNSS 3 Click

开发板

Nucleo 32 with STM32F031K6 MCU

编译器

NECTO Studio

微控制器单元

STM32F031K6

我们先进的GNSS解决方案通过提供实时定位数据,支持导航、地图绘制和地理分析,增强了决策制定和生产力。

A

A

硬件概览

它是如何工作的?

GNSS 3 Click基于SIMCom的SIM33ELA模块,这是一个独立或A-GPS接收器,带有内置的芯片天线。SIM33ELA仅支持L1频段,具有33个跟踪和99个获取通道。该模块提供从天线输入到主机端口的完整信号处理,可以通过NMEA消息传输,最大更新速率为10Hz。该模块是一款超低功耗跟踪设备,跟踪时灵敏度高达-165dBm,获取模式下为-147dBm,并具有快速重新获取时间。可见卫星数量的增加提高了定位精度(<2.5m CEP),减少了获取时间(<1.5s TTFF,热启动)。GNSS 3 Click支持抗干扰,在信号弱的条件下通过板载LNA和12个多音调主动干扰抵消器实现更好的定位。SIM33ELA支持EPO(扩展预测轨道)数据服务,可以向客户提供7/14/31天的轨道预

测,定期从EPO服务器下载。诸如星历、 星历、粗略的上次位置和时间、卫星状态以及可选的时间同步等信息将减少TTFF。它可以通过主机端上传到SIM33ELA模块。EASY(嵌入式助手系统)模式从接收到的星历预测卫星导航消息。该模块还支持DGPS SBAS(卫星增强系统)和RTCM,一次只能使用一种模式。SBAS取决于用户所在的大陆。SIM33ELA使用UART接口,常用的UART RX和TX引脚作为主机微控制器的默认通信协议。默认配置下,它以115200bps的速率进行操作以传输和交换数据。此外,这款Click board™还具有通过mikroBUS™信号可访问的其他功能,例如用于重置设备的复位(RST)和INT引脚,可以控制模块进入或从睡眠模式唤醒。除了

可以使用内置的芯片天线之外,这款Click board™还可以使用Mikroe提供的外部有源天线,这要归功于板载的n.FL连接器和将ANT SEL焊接跳线设置为INT或EXT位置。除了精确定位外,GNSS 3 Click还通过红色LED指示器(标记为PPS)指示准确的定时信号,黄色LED指示器(标记为FIX)指示成功的定位,以及绿色PWR LED,用作唤醒指示器。此Click board™只能使用3.3V逻辑电压级别进行操作。在使用具有不同逻辑电压级别的MCU之前,必须对板执行适当的逻辑电压级别转换。此外,它配备了一个包含函数和示例代码的库,可供进一步开发参考。

GNSS 3 Click hardware overview image

功能概述

开发板

Nucleo 32开发板搭载STM32F031K6 MCU,提供了一种经济且灵活的平台,适用于使用32引脚封装的STM32微控制器进行实验。该开发板具有Arduino™ Nano连接性,便于通过专用扩展板进行功能扩展,并且支持mbed,使其能够无缝集成在线资源。板载集成

ST-LINK/V2-1调试器/编程器,支持通过USB重新枚举,提供三种接口:虚拟串口(Virtual Com port)、大容量存储和调试端口。该开发板的电源供应灵活,可通过USB VBUS或外部电源供电。此外,还配备了三个LED指示灯(LD1用于USB通信,LD2用于电源

指示,LD3为用户可控LED)和一个复位按钮。STM32 Nucleo-32开发板支持多种集成开发环境(IDEs),如IAR™、Keil®和基于GCC的IDE(如AC6 SW4STM32),使其成为开发人员的多功能工具。

Nucleo 32 with STM32F031K6 MCU double side image

微控制器概述 

MCU卡片 / MCU

default

建筑

ARM Cortex-M0

MCU 内存 (KB)

32

硅供应商

STMicroelectronics

引脚数

32

RAM (字节)

4096

你完善了我!

配件

Click Shield for Nucleo-32是扩展您的开发板功能的理想选择,专为STM32 Nucleo-32引脚布局设计。Click Shield for Nucleo-32提供了两个mikroBUS™插座,可以添加来自我们不断增长的Click板™系列中的任何功能。从传感器和WiFi收发器到电机控制和音频放大器,我们应有尽有。Click Shield for Nucleo-32与STM32 Nucleo-32开发板兼容,为用户提供了一种经济且灵活的方式,使用任何STM32微控制器快速创建原型,并尝试各种性能、功耗和功能的组合。STM32 Nucleo-32开发板无需任何独立的探针,因为它集成了ST-LINK/V2-1调试器/编程器,并随附STM32全面的软件HAL库和各种打包的软件示例。这个开发平台为用户提供了一种简便且通用的方式,将STM32 Nucleo-32兼容开发板与他们喜欢的Click板™结合,应用于即将开展的项目中。

Click Shield for Nucleo-32 accessories 1 image

使用的MCU引脚

mikroBUS™映射器

NC
NC
AN
Reset
PA11
RST
Wake Up Interrupt
PA4
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
NC
NC
INT
UART TX
PA10
TX
UART RX
PA9
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

GNSS 3 Click Schematic schematic

一步一步来

项目组装

Click Shield for Nucleo-144 front image hardware assembly

从选择您的开发板和Click板™开始。以Nucleo 32 with STM32F031K6 MCU作为您的开发板开始。

Click Shield for Nucleo-144 front image hardware assembly
Nucleo 144 with STM32L4A6ZG MCU front image hardware assembly
Stepper 22 Click front image hardware assembly
Prog-cut hardware assembly
Nucleo-32 with STM32 MCU Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
STM32 M4 Clicker HA MCU/Select Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

实时跟踪您的结果

应用程序输出

此款Click板可通过两种方式进行接口连接和监控:

  • Application Output - 在调试模式下,使用“Application Output”窗口进行实时数据监控。按照本教程正确设置它。

软件支持

库描述

这个库包含了GNSS 3 Click驱动程序的API。

关键功能:

  • gnss3_parse_gngga - GNSS 3解析GNGGA函数

  • gnss3_generic_read - 通用读取函数

  • gnss3_module_wakeup - 唤醒模块函数

开源

代码示例

完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio 应用程序代码也可以在MIKROE的GitHub账户中找到。

/*!
 * \file 
 * \brief Gnss3 Click example
 * 
 * # Description
 * This example demonstrates the use of GNSS 3 click by reading and displaying
 * the GPS coordinates.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and resets the click board.
 *
 * ## Application Task
 * Reads the received data, parses the GNGGA info from it, and once it receives the position fix
 * it will start displaying the coordinates on the USB UART.
 *
 * ## Additional Function
 * - static void gnss3_clear_app_buf ( void )
 * - static err_t gnss3_process ( gnss3_t *ctx )
 * - static void gnss3_parser_application ( char *rsp )
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "gnss3.h"

#define PROCESS_BUFFER_SIZE 200

static gnss3_t gnss3;
static log_t logger;

static char app_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;
static int32_t app_buf_cnt = 0;

/**
 * @brief GNSS 3 clearing application buffer.
 * @details This function clears memory of application buffer and reset its length and counter.
 * @return None.
 * @note None.
 */
static void gnss3_clear_app_buf ( void );

/**
 * @brief GNSS 3 data reading function.
 * @details This function reads data from device and concatenates data to application buffer.
 * @param[in] ctx : Click context object.
 * See #gnss3_t object definition for detailed explanation.
 * @return @li @c  0 - Read some data.
 *         @li @c -1 - Nothing is read or Application buffer overflow.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t gnss3_process ( gnss3_t *ctx );

/**
 * @brief GNSS 3 parser application.
 * @param[in] rsp Response buffer.
 * @details This function logs GNSS data on the USB UART.
 * @return None.
 * @note None.
 */
static void gnss3_parser_application ( char *rsp );

void application_init ( void )
{
    log_cfg_t log_cfg;
    gnss3_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, "---- Application Init ----" );

    //  Click initialization.

    gnss3_cfg_setup( &cfg );
    GNSS3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    gnss3_init( &gnss3, &cfg );

    gnss3_module_wakeup( &gnss3 );
    Delay_ms( 1000 );
}

void application_task ( void )
{
    gnss3_process( &gnss3 );
    if ( app_buf_len > ( sizeof ( ( char * ) GNSS3_RSP_GNGGA ) + GNSS3_GNGGA_ELEMENT_SIZE ) ) 
    {
        gnss3_parser_application( app_buf );
    }
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

static void gnss3_clear_app_buf ( void ) 
{
    memset( app_buf, 0, app_buf_len );
    app_buf_len = 0;
    app_buf_cnt = 0;
}

static err_t gnss3_process ( gnss3_t *ctx ) 
{
    int32_t rx_size = 0;
    char rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
    rx_size = gnss3_generic_read( ctx, rx_buf, PROCESS_BUFFER_SIZE );
    if ( rx_size > 0 ) 
    {
        int32_t buf_cnt = 0;
        if ( ( app_buf_len + rx_size ) > PROCESS_BUFFER_SIZE ) 
        {
            gnss3_clear_app_buf(  );
            return GNSS3_ERROR;
        } 
        else 
        {
            buf_cnt = app_buf_len;
            app_buf_len += rx_size;
        }
        for ( int32_t rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ ) 
        {
            if ( rx_buf[ rx_cnt ] ) 
            {
                app_buf[ ( buf_cnt + rx_cnt ) ] = rx_buf[ rx_cnt ];
            }
            else
            {
                app_buf_len--;
                buf_cnt--;
            }
        }
        return GNSS3_OK;
    }
    return GNSS3_ERROR;
}

static void gnss3_parser_application ( char *rsp )
{
    char element_buf[ 100 ] = { 0 };
    if ( GNSS3_OK == gnss3_parse_gngga( rsp, GNSS3_GNGGA_LATITUDE, element_buf ) )
    {
        static uint8_t wait_for_fix_cnt = 0;
        if ( strlen( element_buf ) > 0 )
        {
            log_printf( &logger, "\r\n Latitude: %.2s degrees, %s minutes \r\n", element_buf, &element_buf[ 2 ] );
            gnss3_parse_gngga( rsp, GNSS3_GNGGA_LONGITUDE, element_buf );
            log_printf( &logger, " Longitude: %.3s degrees, %s minutes \r\n", element_buf, &element_buf[ 3 ] );
            memset( element_buf, 0, sizeof( element_buf ) );
            gnss3_parse_gngga( rsp, GNSS3_GNGGA_ALTITUDE, element_buf );
            log_printf( &logger, " Altitude: %s m \r\n", element_buf );
            wait_for_fix_cnt = 0;
        }
        else
        {
            if ( wait_for_fix_cnt % 5 == 0 )
            {
                log_printf( &logger, " Waiting for the position fix...\r\n\n" );
                wait_for_fix_cnt = 0;
            }
            wait_for_fix_cnt++;
        }
        gnss3_clear_app_buf(  );
    }
}

// ------------------------------------------------------------------------ END

额外支持

资源

喜欢这个项目吗?

'购买此套件' 按钮会直接带您进入购物车,您可以在购物车中轻松添加或移除产品。