Skip to content

SDK BC66

Georgi Angelov edited this page Mar 12, 2020 · 30 revisions

New version

Support:

  • GCC C/C++ FULL ( as much as possible... unistd, printf, sockets... etc )
  • Quectel OpenCPU ( as is )
  • Arduino ( as is ) ( not support older versions )
  • Last Quectel SDK v1.5
  • Two last firmwares:
    • BC66NBR01A10 ( SDK 1.5 ) recommended
    • BC66NBR01A07 ( SDK 1.4 )

Еxtras:

  • stdio ... printf, puts ... etc
  • unistd sockets
  • Basic pthreads
  • HTTP/S client
  • MQTT/tls
  • Small File System for setting files ( disabled for now )
  • EXAMPLES

Mix example

#include <Arduino.h>
#include <os_api.h>
#include <stdio.h>
#include <string>

void foo(void)
{
    printf("[APP] Hello World");
    std::string s = "We think in generalities, ";
    s += "but we live in details.";
    int res, sockfd = 0;
    struct sockaddr_in serv_addr;
    resolveAddress("wizio.eu", &serv_addr);
    serv_addr.sin_family = AF_INET;
    serv_addr.sin_port = htons(80);
    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd >= 0)
    {
        if (0 == connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)))
        {
            res = send(sockfd, s.c_str(), s.length(), 0);
            printf("Sent %d bytes\n", res);
            closesocket(sockfd);
        }
    }
}

void print_now()
{ // http://www.cplusplus.com/reference/ctime/asctime/
  time_t rawtime;
  struct tm *timeinfo;
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  printf("\n[APP] Now is: %s", asctime(timeinfo));
}

void setup()
{
  Serial.begin(115200, true); // enable printf
  Serial.printf("\n[APP] Quectel %s Arduino 2020 Georgi Angelov\n", os_api_get_firmware());
  do_connect(8, 0); // band & noSleep
  Serial.println("[APP] Net ready");
  print_now();
}

void loop()
{
  foo();
  delay(30000);
}

OpenCPU

  • Create New OpenCPU Project, PIO will make basic C template...
  • By default some RIL functions is disabled, see your project/custom_feature_def.h

C++

  • Create New OpenCPU Project, PIO will make basic C template...
  • Rename main.c to main.cpp
#include <os_wizio.h>
void proc_main_task(s32 taskId) {
    os_init();  // init cpp, see code
    ST_MSG msg;
    /* your code */
    while (1) {
        Ql_OS_GetMessage(&msg);
        switch (msg.message) {
            /* your code */
        }
    }
}

Arduino

  • Create New Arduino Project
#include <Arduino.h>
void setup() { ... }
void loop()  { ... }

platformio.ini

[env:bc66]
platform = quectel
board = bc66
framework = arduino

upload_port   = COM3
monitor_port  = COM3
monitor_speed = 115200

;   Change Quectel SDK, empty is SDK15 
;board_build.sdk = for future 

;   The Platform use "-specs=nano.specs", this key will enable full specs, if you need
;board_build.disable_nano = 1

;   Other flags as PIO 
;   https://docs.platformio.org/en/latest/projectconf/section_env_build.html
build_flags = 
  -DSOME_KEY
  -IC:/include/search/path
  -LC:/library/search/path
  -lLibraryName

Project

Old Version 2.0.20 (for manual install)