Wiz-IO / Arduino-Quectel-BC66

Arduino port for Quectel BC66 LTE Narow Band modules ( OpenCPU based )
46 stars 20 forks source link

document #1

Closed simonchen007 closed 4 years ago

simonchen007 commented 5 years ago

nice project, does this have documents ?

Wiz-IO commented 5 years ago

the project is at an early stage... Quectel module too what documents do you need, I have for module and can upload

Wiz-IO commented 5 years ago

https://www.quectel.com/product/bc66.htm

simonchen007 commented 5 years ago

thanks for your fast reply, I saw your example just now , I need the API document , somethig like "Ql_RIL_SendATCmd()" , "RIL_NW_GetEGPRSState()" , where to found those ? and I'm finding a "eeprom" example.

thanks

Wiz-IO commented 5 years ago

for Arduino I collect all URC values in dev.state[] array, index is enumeration urc_states_e in interface.h -1 is default error value dev.state[URC_STATE_NW_EGPRS] = 1 is NB connected 0 - no net, 2 searching

I use simply in setup/loop

void setup() { int led = 1, rc = 0; Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, 1); while (dev.state[RIL_READY] != 1) { delay(200); // wait RIL to be ready digitalWrite(LED_BUILTIN, ++led ^ 1); } // now we can send AT commands while (dev.state[URC_STATE_NW_EGPRS] != 1) { delay(100); // wait Narrow Band digitalWrite(LED_BUILTIN, ++led ^ 1); } //Network is ready

Wiz-IO commented 5 years ago

in original OpenCPU if Ql_RIL_Initialize() is called in main task task receive some URC values as system messages as SIM state, NWx states... etc If not - there not have URC messages, and RIL API cannot be used for Arduino I collect all this values to dev.state[]

typedef s32 (Callback_ATResponse)(char line, u32 len, void* userData);

extern s32 Ql_RIL_SendATCmd( char atCmd, // AT command... "AT+CEREG?\n" u32 atCmdLen, // 10 Callback_ATResponse atRsp_callBack, // if need value, void userData, // callback arguments, return value u32 timeOut // in milisec, );

callback receive data line by line and need to be parsed

static s32 ril_IMEI_Handler(char line, u32 len, void userdata) { // AT+GSN\n if (!userdata) return RIL_ATRSP_FAILED; char p = (char) userdata; if ( strlen(line) > 17) memcpy(userdata, &line[2], 15); if (strstr(line, "OK")) return RIL_ATRSP_SUCCESS; if (strstr(line, "ERROR")) return RIL_ATRSP_FAILED; return RIL_ATRSP_CONTINUE; //continue wait }

Wiz-IO commented 5 years ago

s32 RIL_NW_GetEGPRSState(s32 *value)

int v; if ( 0 != RIL_NW_GetEGPRSState(&v) ) ERROR v = 0 no net v = 2 serching v = 1 ok

simonchen007 commented 5 years ago

very thanks. can you please also show me a eeprom example ?

Wiz-IO commented 5 years ago

I am not ready for Eeprom library You can see at ql_system.h functions s32 Ql_SecureData_Store(u8 index , u8 pData, u32 len); s32 Ql_SecureData_Read(u8 index, u8 pBuffer, u32 len); this gives a Quectel for user data save (note: this functions is for B modules)

uint8_t data[50]; if (0 == Ql_SecureData_Read(1, data, 50));

simonchen007 commented 5 years ago

oh, that functions can used for save data in flash ? that's good.

thanks alots

Wiz-IO commented 5 years ago

yep, for now it is, I will later analyze for opportunities

chemmex commented 5 years ago

Any chance to move beyond bc66 to other mt2625-based modules such as Simcom?

Wiz-IO commented 5 years ago

maybe later... I have SimCom SDK but I not have SimCom hardware for test