Platform IO/Visual Code compilation errors

Hi,

Sorry to worry you, I’m using Platformio on VisualCode to develop on my CubeCell HTCC-AB02A.

My code is this one
#include “LoRaWan_APP.h”
#include “Arduino.h”

/*
 * set LoraWan_RGB to 1,the RGB active in loraWan
 * RGB red means sending;
 * RGB green means received done;
 */
#ifndef LoraWan_RGB
#define LoraWan_RGB DEACTIVE
#endif



#define RF_FREQUENCY                                868000000 // Hz

#define TX_OUTPUT_POWER                             5        // dBm

#define LORA_BANDWIDTH                              0         // [0: 125 kHz,
                                                              //  1: 250 kHz,
                                                              //  2: 500 kHz,
                                                              //  3: Reserved]
#define LORA_SPREADING_FACTOR                       7         // [SF7..SF12]
#define LORA_CODINGRATE                             1         // [1: 4/5,
                                                              //  2: 4/6,
                                                              //  3: 4/7,
                                                              //  4: 4/8]
#define LORA_PREAMBLE_LENGTH                        8         // Same for Tx and Rx
#define LORA_SYMBOL_TIMEOUT                         0         // Symbols
#define LORA_FIX_LENGTH_PAYLOAD_ON                  false
#define LORA_IQ_INVERSION_ON                        false


#define RX_TIMEOUT_VALUE                            1000
#define BUFFER_SIZE                                 30 // Define the payload size here

char txpacket[BUFFER_SIZE];
char rxpacket[BUFFER_SIZE];

static RadioEvents_t RadioEvents;
void OnTxDone( void );
void OnTxTimeout( void );
void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr );

typedef enum
{
    LOWPOWER,
    RX,
    TX
}States_t;

int16_t txNumber;
States_t state;
bool sleepMode = false;
int16_t Rssi,rxSize;


void setup() {
    boardInitMcu( );
    Serial.begin(115200);

    txNumber=0;
    Rssi=0;

    RadioEvents.TxDone = OnTxDone;
    RadioEvents.TxTimeout = OnTxTimeout;
    RadioEvents.RxDone = OnRxDone;

    Radio.Init( &RadioEvents );
    Radio.SetChannel( RF_FREQUENCY );
    Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
                                   LORA_SPREADING_FACTOR, LORA_CODINGRATE,
                                   LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
                                   true, 0, 0, LORA_IQ_INVERSION_ON, 3000 );

    Radio.SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR,
                                   LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH,
                                   LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON,
                                   0, true, 0, 0, LORA_IQ_INVERSION_ON, true );
    state=TX;
}



void loop()
{
	switch(state)
	{
		case TX:
			delay(1000);
			txNumber++;
		    sprintf(txpacket,"%s","hello");
		    sprintf(txpacket+strlen(txpacket),"%d",txNumber);
		    sprintf(txpacket+strlen(txpacket),"%s"," Rssi : ");
		    sprintf(txpacket+strlen(txpacket),"%d",Rssi);
		    //turnOnRGB(COLOR_SEND,0);

		    Serial.printf("\r\nsending packet \"%s\" , length %d\r\n",txpacket, strlen(txpacket));

		    Radio.Send( (uint8_t *)txpacket, strlen(txpacket) );
		    state=LOWPOWER;
		    break;
		case RX:
			Serial.println("into RX mode");
		    Radio.Rx( 0 );
		    state=LOWPOWER;
		    break;
		case LOWPOWER:
			lowPowerHandler();
		    break;
        default:
            break;
	}
    Radio.IrqProcess( );
}

void OnTxDone( void )
{
	Serial.print("TX done......");
	//turnOnRGB(0,0);
	state=RX;
}

void OnTxTimeout( void )
{
    Radio.Sleep( );
    Serial.print("TX Timeout......");
    state=TX;
}
void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr )
{
    Rssi=rssi;
    rxSize=size;
    memcpy(rxpacket, payload, size );
    rxpacket[size]='\0';
    //turnOnRGB(COLOR_RECEIVED,0);
    Radio.Sleep( );

    Serial.printf("\r\nreceived packet \"%s\" with Rssi %d , length %d\r\n",rxpacket,Rssi,rxSize);
    Serial.println("wait to send next packet");

    state=TX;
} 

I have this error message:

CONFIGURATION: https://docs.platformio.org/page/boards/asrmicro650x/cubecell_node.html
PLATFORM: ASR Microelectronics ASR650x (1.2.1) > Heltec CubeCell-1/2AA Node (HTCC-AB02A)
HARDWARE: ASR6502 48MHz, 16KB RAM, 128KB Flash
PACKAGES: 
 - framework-arduinoasrmicro650x 1.2.0 
 - tool-cubecellelftool 0.0.1 
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 15 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <LoRa> 1.0
|   |-- <RGB> 1.0
|   |-- <OLED> 1.0
Building in release mode
Compiling .pio/build/cubecell_node/src/main.cpp.o
Compiling .pio/build/cubecell_node/lib858/LoRa/LoRaWan_APP.cpp.o
Compiling .pio/build/cubecell_node/FrameworkArduino/asr650x/cores/ADC_SAR_Seq_INT.c.o
Compiling .pio/build/cubecell_node/FrameworkArduino/asr650x/cores/ADC_SAR_Seq_IRQ.c.o
Compiling .pio/build/cubecell_node/FrameworkArduino/asr650x/cores/ADC_SAR_Seq_PM.c.o
Compiling .pio/build/cubecell_node/FrameworkArduino/asr650x/cores/ADC_SAR_Seq_intClock.c.o
Compiling .pio/build/cubecell_node/FrameworkArduino/asr650x/cores/I2C_1_I2C.c.o
/Users/robino/.platformio/packages/framework-arduinoasrmicro650x/libraries/LoRa/src/LoRaWan_APP.cpp:4:29: error: 'RGB' was not declared in this scope
    4 | CubeCell_NeoPixel pixels(1, RGB, NEO_GRB + NEO_KHZ800);
      |                             ^~~
Compiling .pio/build/cubecell_node/FrameworkArduino/asr650x/cores/I2C_1_I2C_INT.c.o
Compiling .pio/build/cubecell_node/FrameworkArduino/asr650x/cores/I2C_1_I2C_MASTER.c.o
/Users/robino/.platformio/packages/framework-arduinoasrmicro650x/libraries/LoRa/src/LoRaWan_APP.cpp: In function 'void lwan_dev_params_update()':
/Users/robino/.platformio/packages/framework-arduinoasrmicro650x/libraries/LoRa/src/LoRaWan_APP.cpp:470:43: error: 'AS923_LC3' was not declared in this scope; 

Important: With the same code if I use Arduino IDE all is working fine.

Thanks for your help.

I don’t know if it can help but I add in LoRaWan_APP.c this variables and it seems to work
#ifndef RGB
#define RGB 1
#endif
#ifndef REGION_EU868
#define REGION_EU868 1
#endif

Perhaps the issue is that I have to define GLOBAL ENV before compiling ? but when I put this variables in the main.cc nothing changes…

Ok I found just addind in platformio.ini this variables:
build_flags=
-D REGION_EU868
-D RGB

1 Like