Questions and discussions about the software that runs on the TD RF module itself.
axelC
 
Posts: 16
Joined: Wed Feb 17, 2016 2:44 pm

redefine GPS_VIO_PORT/GPS_VIO_BIT

by axelC Tue May 03, 2016 10:44 am

Hi,

In my project I need to change the GPS_VIO_PORT and GPS_VIO_BIT in order to use the USR2 pin as an impulse counter

So instead of the
Code: Select all
#define GPS_VIO_PORT          USR2_PORT
#define GPS_VIO_BIT          USR2_BIT

I need to setup
Code: Select all
#define GPS_VIO_PORT          TIM2_PORT
#define GPS_VIO_BIT          TIM2_BIT


I try to do it before including <td_config.h>
Code: Select all
#include "config.h"            //My config file that redefine GPS_VIO_PORT/BIT
/* This file declare all "dynamic" library data. It should be last included file
 * Standard size value can be override before including this file
 */
#include <td_config.h>


I get the warning message :
Code: Select all
...TD_RF_Module_SDK\lib\libtdcore\inc/td_config_chip.h:115:0: warning: "GPS_VIO_PORT" redefined [enabled by default]
In file included from ..\src\user_main.c:37:0:
...\inc/config.h:21:0: note: this is the location of the previous definition


But the GPS stack fails and I have this message on the serial link:
Code: Select all
***** App start *****
Start fixing
[TRAP] Time:0.00:00:01.  1 : 25:GPS hard error | Param:0x00000000(0)
-- TRAP DUMP --
MSP:0x00000000 LINK:0x00008057
IRQTable:0x00000000
NVIC->IABR:0x00000000,0x00000000
HardFaultStR:0x00000000
FaultStatus:0x00000000:
Stack:0x200020A0-0x20002880
0x20002780 : 20002780 00000004 A90B0B00 20002880
0x20002790 : 00000200 20003E70 20001C60 00009951
0x200027A0 : 0000E41F 200027B4 A90B0B40 00007C87
0x200027B0 : 0000E41F 0000E41F 0000E429 200027B4
0x200027C0 : 00000000 0000E204 0000003C 000003E8
0x200027D0 : 00008026 00008057 00000001 00000001
0x200027E0 : 00000000 19007F8D 00000000 00000019
0x200027F0 : 00000001 00001A70 20003E70 00007E13
0x20002800 : 00000003 000000B4 FFFFFFFF 00000691
0x20002810 : 00000003 00000B45 00000003 000000B4
0x20002820 : 000004F1 00000E10 20000618 0000044D
0x20002830 : 00000E10 40000000 20001C40 0000024B
0x20002840 : 00000A28 00009AFD 00009AAD 00009BF9
0x20002850 : 00000000 00000301 00000000 0000E838
0x20002860 : 20000618 FFFFFFFF 00001A70 0000CE3D
0x20002870 : 00000000 00000129 00001A70 000000BD
-- TRAP Trace@0x20000000 --
Var 0:0
Var 1:0
Var 2:0
Var 3:71
Var 4:0
Var 5:0
Var 6:0
Var 7:23
-Stack trace-
 0|0x0000804F
 1|0x00007E13
 2|0x00000691
 3|0x00000B45
 4|0x000004F1
 5|0x0000044D
 6|0x0000024B
 7|0x00009AFD
 8|0x00009AAD
 9|0x00009BF9
10|0x00000301
11|0x0000CE3D


THe only way i found is to comment the lines in td_config_chip.h
Code: Select all
//#define GPS_VIO_PORT       USR2_PORT
//#define GPS_VIO_BIT          USR2_BIT


Do you know if there is a solution in order not to edit the telecom design sdk files?

I work now with sdk 6.3.2 but it was the same with 5.X.X
I compile with eclips on Windows 10

Thanks
User avatar
lcheminade
 
Posts: 146
Joined: Mon May 11, 2015 7:47 am

Re: redefine GPS_VIO_PORT/GPS_VIO_BIT

by lcheminade Fri Jun 17, 2016 1:54 pm

You can do that but you will need to physically connect TIM2 to IO_EXT.
axelC
 
Posts: 16
Joined: Wed Feb 17, 2016 2:44 pm

Re: redefine GPS_VIO_PORT/GPS_VIO_BIT

by axelC Fri Jun 17, 2016 2:28 pm

The physical connexion is already done in our products, we use it since a year.
Our actual code works, it is just about correctly write my code.

My question is about the code writing to avoid editing SDK files

The code sample say:
Code: Select all
/* This file declare all "dynamic" library data. It should be last included file
 * Standard size value can be override before including this file
 */
#include <td_config.h>


But when I want to override the flowing standards values : GPS_VIO_PORT/GPS_VIO_BIT they are not taken into account.
User avatar
lcheminade
 
Posts: 146
Joined: Mon May 11, 2015 7:47 am

Re: redefine GPS_VIO_PORT/GPS_VIO_BIT

by lcheminade Mon Jul 04, 2016 7:21 am

Ok sorry about the misunderstanding. The issue is the #define CHIP_TD1204 which does not allow your defines. A solution would be to do undef CHIP_TD1204, copy the CHIP_TD1204 definition into your local config file, change the GPS part then include td_config.h.

#undef CHIP_TD1204


#define POWER_CRYSTAL_PORT gpioPortF /**< Power RF Crystal port */
#define POWER_CRYSTAL_BIT 2 /**< Power RF Crystal bit */
#define SHTD_PORT gpioPortC /**< RF GPIO 1 port */
#define SHTD_BIT 13 /**< RF GPIO 1 bit */
#define GPS_CS_PORT gpioPortB
#define GPS_CS_BIT 13
#define GPS_IRQ_PORT gpioPortC
#define GPS_IRQ_BIT 1
#define GPS_RESET_PORT TD_GPIO_PortRadio
#define GPS_RESET_BIT 2
#define GPS_VBCKP_PORT TD_GPIO_PortRadio /**< port 0x10 is Silabs */
#define GPS_VBCKP_BIT 3
#define GPS_VIO_PORT TIM2_PORT
#define GPS_VIO_BIT TIM2_BIT
#define ACCELERO_CS_PORT USR1_PORT
#define ACCELERO_CS_BIT USR1_BIT
#define ACCELERO_IRQ_PORT USR4_PORT
#define ACCELERO_IRQ_BIT USR4_BIT
#define RADIO_INFO_PIN 0
#define RADIO_INFO_PORT gpioPortB
#define RADIO_INFO_BIT 14
#define RADIO_USE_TCXO 1

#ifndef PRODUCT_INIT_DATA
#define PRODUCT_INIT_DATA\
{PIP(gpioPortB,13,PI_DISABLED,1), /* CS pull-up to 1 for GPS and accelerometer */ \
PIP(gpioPortC,15,PI_OUTPUT,1)}
#define RADIO_INIT_DATA GPIO_TRISTATE, GPIO_RX_RAW_DATA_OUT, \
GPIO_TRISTATE, GPIO_DRIVE0, GPIO_NOP
#endif
#ifndef TD_GEOLOC_USE_CODE
#define TD_GEOLOC_USE_CODE 1
#endif
#ifndef TD_STACK_PROTECT
#define TD_STACK_PROTECT 1
#endif
#define TARGET_COMPILER_GCC


#include <td_config.h>
Return to Firmware

Who is online

Users browsing this forum: No registered users and 29 guests