Globalsat TR-600G

From OpenStreetMap Wiki
Jump to navigation Jump to search

This page collects the detailed hardware information for Globalsat TR-600GLONass tracker.

CPU

STM32F103RCT6

STM32_USART3 <-> GPS
STM32_USART2 <-> GSM
STM32_USART1 <-> RS232

RCC

RCC_DeInit();

RCC_HSICmd(ENABLE); // 1. Clocking the controller from internal HSI RC (8 MHz)
while (RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);
//RCC_SYSCLKConfig(RCC_SYSCLKSource_HSI); SYSCLK = HSI

FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
FLASH_SetLatency(FLASH_Latency_2);

RCC_HCLKConfig(RCC_SYSCLK_Div1); // AHB clock (HCLK) = SYSCLK/1
RCC_PCLK2Config(RCC_HCLK_Div2); //High Speed APB2 clock (PCLK2) = HCLK/2
RCC_PCLK1Config(RCC_HCLK_Div2); //Low Speed APB1 clock (PCLK1) = HCLK/2
RCC_ADCCLKConfig(RCC_PCLK2_Div6); //ADCCLK=PCLK2/6

RCC_PLLConfig(RCC_PLLSource_HSI_Div2,RCC_PLLMul_6); //PLLCLK = HSI/2 *6 = 24 MHz
RCC_PLLCmd(ENABLE);

while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);

RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); // RCC_SYSCLKSource_PLLCLK: PLL selected as system clock
while (RCC_GetSYSCLKSource() !=0x08); // 0x08: PLL used as system clock

NVIC_SetVectorTable(NVIC_VectTab_FLASH,0x9800); // u32 NVIC_VectTab, u32 Offset
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO|RCC_APB2Periph_GPIOA|...,ENABLE); // AFIO,PA,PB,PC,PD
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR|RCC_APB1Periph_BKP,ENABLE);

GPIO_PinRemapConfig(GPIO_Remap_PD01, ENABLE); /* PD01 Alternate Function mapping */ 
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); /* Full SWJ Disabled (JTAG-DP + SW-DP) */

MAPR

GPIO_PinRemapConfig(GPIO_Remap_PD01,ENABLE);
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable,ENABLE);

GPIO

0001 PA0    cfg AIN ADC1_IN0 AnalogIN
0002 PA1    cfg AIN ADC1_IN1 PCB_T
0004 PA2  + cfg A   uart2tx gsm
0008 PA3  + cfg A   uart2rx gsm
0010 PA4    cfg A   SPI1_CS spi_flash                  =1
0020 PA5  + cfg A   SPI1_CLK spi_flash
0040 PA6  + cfg A   SPI1_MISO spi_flash
0080 PA7  + cfg A   SPI1_MOSI spi_flash
0100 PA8    cfg O                                      =0
0200 PA9    cfg A   uart1rx rs232
0400 PA10 + cfg A   uart1tx rs232
0800 PA11 +     I   ACC ,  ID=d          IRQ iRQ REFE
1000 PA12 + cfg O    ?                                 =0
2000 PA13 + cfg O   Dout1                              =0
4000 PA14   cfg O   fw related                         =0
8000 PA15   cfg O   Dout3                              =0
0001 PB0    cfg I   ID=5 unused GSM_RI?   IRQ iRQ FE
0002 PB1    cfg I   ID=7 unused vib alrm IRQ iRQ RE
0004 PB2  + cfg I   boot1 ID=e  gps ant  IRQ iRQ RE
0008 PB3  + cfg I   tst in EMS, gps ant short
0010 PB4    cfg OI  gps ant I ID=6 unused              =0
0020 PB5  + cfg O   I ID=8 unused                      =1
0040 PB6    cfg A   I2C1_SCL
0080 PB7    cfg A   I2C1_SDA  
0100 PB8    cfg O   Dout2                              =0

EXTI

 0 exti     1 Bit0    PB0 INT_GSM_RI?          EXTI_Mode_Interrupt EXTI_Trigger_Falling        EXTI0_IRQn,7
 1 exti     2 Bit1    PB1 INT_VIBRATION        EXTI_Mode_Interrupt EXTI_Trigger_Rising         EXTI1_IRQn,9
 2 exti     4 Bit2  + PB2 INT_GpsAntenna       EXTI_Mode_Interrupt EXTI_Trigger_Rising         EXTI2_IRQn,b
 3  -       8         unused
 4 exti_o  10       + PC4 INT_Din1             EXTI_Mode_Interrupt EXTI_Trigger_Rising_Falling EXTI4_IRQn,f
 5 exti_o  20       + PC5 INT_Din2             EXTI_Mode_Interrupt EXTI_Trigger_Rising_Falling EXTI9_5_IRQn,f
 6  -      40         unused
 7  -      80         unused
 8  -     100         unused
 9 exti_o 200       + PC9 INT_Din3             EXTI_Mode_Interrupt EXTI_Trigger_Rising_Falling EXTI9_5_IRQn,f
10  -     400         unused  
11 exti   800 Bit11 + PA11 INT_ACC ?           EXTI_Mode_Interrupt EXTI_Trigger_Rising_Falling EXTI15_10_IRQn,e
12  -    1000         unused
13 exti  2000 Bit13 + PB13 INT_SOS             EXTI_Mode_Interrupt EXTI_Trigger_Falling        EXTI15_10_IRQn,e
14 exti  4000 Bit14 + PB14 INT_MainBatConn     EXTI_Mode_Interrupt EXTI_Trigger_Falling        EXTI15_10_IRQn,a
15 exti  8000 Bit15   PB15 INT_GSM_VDD?        EXTI_Mode_Interrupt EXTI_Trigger_Falling        EXTI15_10_IRQn,6

ADC

ADC_Mode=ADC_Mode_Independent, 
ADC_ScanConvMode=ENABLE, 
ADC_ContinuousConvMode=ENABLE, 
ADC_ExternalTrigConv=ADC_ExternalTrigConv_None, 
ADC_DataAlign=ADC_DataAlign_Right, 
ADC_NbrOfChannel=6

adc1,a,1,2 (MAIN_BAT)        val*2850/4096*10
adc1,1,2,2 (PCB_T)           TAB1(20000*val/(4095-val))
adc1,d,3,2 (Li_BAT)          TAB2(val*2850/4096*2)
adc1,c,4,2 (LiBat_T)         TAB1(20000*val/(4095-val))
adc1,0,5,2 AnalogInput ?     val*2850/4096*10
adc1,b,6,2 BackupBat? val*2850/4096*10

SPI

SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;  
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;   
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;

I2C

I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 =  0;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = 100000;

DMA

Channel1 unused
Channel2 uart3(gps)rx
Channel3 uart3(gps)tx
Channel4 uart1(comm)rx
Channel5 uart1(comm)tx
Channel6 uart2(gsm)rx
Channel7 uart2(gsm)tx

GSM

Telit GE865-QUAD

GPS

NV08C-CSM v2.1

SPI flash

MXIC MX25L3206BZN

Firmware update

Bootloader mode

======================================================================
=              (C) COPYRIGHT 2010 STMicroelectronics                 =
=                                                                    =
=     In-Application Programming Application  (Version 3.3.0)        =
=                                   By MCD Application Team          =
================== Main Menu ============================
 Download Image To the STM32F10x Internal Flash ------- 1
 Upload Image From the STM32F10x Internal Flash ------- 2
 Execute The New Program ------------------------------ 3
 Disable the write protection ------------------------- 4
==========================================================
================== Bootloader Main Menu ====================

 FW Ver : F-0TR-60GOOO-11102851

 HW Test FW Ver : F-0TR-60GMHT-11081551

 Download Image To the STM32F10x Internal Flash --------- 1

 Execute The New Program -------------------------------- 2

 Download Image To External Serial Flash ---------------- 5

 Download HW Test Image To the STM32F10x Internal Flash - 6

 Execute The HW Test Program ---------------------------- 7

============================================================


TEST MODE START

GSM
tr+din7=1
tr+din7=1
tr+din7=1
tr+din7=1

Custom firmware checksum algorithm

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
                     

int calcrc(char *ptr,	int count)
{
   int	crc, i;

   crc	= 0;
   while (--count >= 0) {
	   crc = crc ^ (int)*ptr++ << 8;
	   for (i = 0; i < 8; ++i)
	       if (crc & 0x8000) 
		   crc = crc <<	1 ^ 0x1021;
	       else
		   crc = crc <<	1;
	   }
   return (crc	& 0xFFFF);
}

typedef  struct __attribute__ ((__packed__)) {
 int32_t magic1;
 char gsatdfu[8];
 int32_t magic2;
 int32_t fw_len;
 int32_t fw_addr;
 char dfu_name[7*4];
 int16_t _pad0;
 int16_t crc16;
 int16_t year;
 int8_t month;
 int8_t day;
 int8_t hour;
 int8_t min;
 int8_t sec;
 int8_t zero;
} tr600_dfu_head;


int main(int argc, char **argv)
{
size_t ilen;
struct stat foo;
FILE *ifd;
char buf[256*1024];
int err;
unsigned short crc;

tr600_dfu_head *head;
  
assert(sizeof(tr600_dfu_head) == 0x40);

if (argc < 2 ) _exit(1);

 
ifd=fopen(argv[1],"r");
if (!ifd)
{
 fprintf(stderr,"can't open %s\n",argv[1]);
 _exit(1);
}


if ((err=stat((const char *)argv[1],&foo))== -1)
{
 fprintf(stderr,"%s\n",strerror(err));
 _exit(1);
}
  
ilen=fread(buf,1,foo.st_size,ifd);
 
head=(tr600_dfu_head *)buf;

crc=calcrc(&buf[0x40],ilen-0x40);

 printf ("magic1=\t\t0x%4.4x / len=0x%x\ngsatdfu=\t%s\nmagic2=\t\t0x%8.8x\nfw_len=\t\t%d / %d\nfw_addr=\t0x%8.8x\ndfuname=\t%s\ncrc=\t\t0x%4.4x / 0x%4.4x\ndatetime=\t%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d.%2.2d\n",
          (head->magic1&0xffff0000)>>16, head->magic1&0xffff,
          head->gsatdfu,
          head->magic2,
          head->fw_len, ilen-sizeof(tr600_dfu_head),
          head->fw_addr,
          head->dfu_name,
          head->crc16&0xffff,
          crc,
          head->year,
          head->month,
          head->day,
          head->hour,
          head->min,
          head->sec,
          head->zero
          );


 return 0;
}

Soft-switch to firmware update

Command=GSC,GlobalSatTR-600,LM*QQ!

======================================================
=   (C) Copyright 2011 GlobalSat Technology Corp.    =
=      TR-600G BootLoader F-0TR-60GBOT-11081551      =
======================================================

================== Bootloader Main Menu ====================

 FW Ver : F-0TR-60GOOO-11102851

 HW Test FW Ver : F-0TR-60GMHT-11081551

 Download Image To the STM32F10x Internal Flash --------- 1

 Execute The New Program -------------------------------- 2

 Download Image To External Serial Flash ---------------- 5

 Download HW Test Image To the STM32F10x Internal Flash - 6

 Execute The HW Test Program ---------------------------- 7

============================================================

Enabling/Switching GNSS

GSS,<imei>,3,0,CE=0*QQ! gps+glonass
GSS,<imei>,3,0,CE=1*QQ! gps only
GSS,<imei>,3,0,CE=2*QQ! glonass only