alan broad
/
carbon_v5_arm_studio
arm studio build
Revision 31:4539c212ecaa, committed 2020-07-29
- Comitter:
- alan1974
- Date:
- Wed Jul 29 05:38:19 2020 +0000
- Parent:
- 30:d9df0092d050
- Commit message:
- updated to libxDot 3.3.5 and mbed_os 5.15.1; build but not working
Changed in this revision
--- a/inc/commI2C.h Wed Jul 29 01:25:20 2020 +0000 +++ b/inc/commI2C.h Wed Jul 29 05:38:19 2020 +0000 @@ -13,7 +13,7 @@ */ #ifndef _COMMI2C_H_ -#define _COMMi2C_H_ +#define _COMMI2C_H_ #include "mbed.h" #include "global.h"
--- a/inc/history.h Wed Jul 29 01:25:20 2020 +0000 +++ b/inc/history.h Wed Jul 29 05:38:19 2020 +0000 @@ -2,6 +2,7 @@ xdot release notes: https://os.mbed.com/teams/MultiTech/wiki/Dot-library-change-log Data: Rev: API: Comments: 000B 004 +28July2020 - updated to libxDot 3.3.5 and mbed_os 5.15.1; build but not working 08Jun2020 - added lorawan version command 08Jun2020 - added gps time command 02Mar2020 - added printout on lora_wake rcvd after initial boot; previously just printed out on subsequent wakes
--- a/libxDot-mbed5.lib Wed Jul 29 01:25:20 2020 +0000 +++ b/libxDot-mbed5.lib Wed Jul 29 05:38:19 2020 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/MultiTech/code/libxDot-mbed5/#3101c522ae11 +http://developer.mbed.org/teams/MultiTech/code/libxDot-mbed5/#fb5769f4a67c
--- a/mbed-os.lib Wed Jul 29 01:25:20 2020 +0000 +++ b/mbed-os.lib Wed Jul 29 05:38:19 2020 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#e4b81f67f939a0c0b11c147ce74aa367271e1279 +https://github.com/ARMmbed/mbed-os/#e642a7d8b3609a7c903e042cd772f00a5d299088
--- a/src/commI2C.cpp Wed Jul 29 01:25:20 2020 +0000 +++ b/src/commI2C.cpp Wed Jul 29 05:38:19 2020 +0000 @@ -29,9 +29,9 @@ //wake.mode(OpenDrain); wake.output(); wake = 1; - wait_ms(10); //proc uses interrupts on lora_wake, so don't need to wait,just pulse it + wait_us(10000); //proc uses interrupts on lora_wake, so don't need to wait,just pulse it wake = 0; //set wake lo - wait_ms(1); + wait_us(1000); wake.input(); //go back to input mode !!! wake pull hi if go back to input mode ??? return; } @@ -87,6 +87,7 @@ } return I2C_READ; default: + return I2C_READ; }; //switch timeout--; @@ -95,4 +96,4 @@ return I2C_WRITE; //just go to sleep } }; //while -} \ No newline at end of file +} \ No newline at end of file
--- a/src/main.cpp Wed Jul 29 01:25:20 2020 +0000 +++ b/src/main.cpp Wed Jul 29 05:38:19 2020 +0000 @@ -221,7 +221,7 @@ dot->setLinkCheckThreshold(link_check_treshold); //---------------------------------------------------------------------------------------------------------------------------------------------- eui = mts::Text::bin2hexString(dot->getDeviceId()).c_str(); - if(verbose)pc.printf("\r\nEUI: %s\r\n",eui); + //if(verbose)pc.printf("\r\nEUI: %s\r\n",eui); bool joined = false; i2c_proc_init(); //init i2c comm @@ -268,7 +268,7 @@ if (bListen4Multicast) { //in ClassC and receiving multicst pkt, stay here until timeout or bListen4Multicast false if(verbose)pc.printf("\n\r changed to class C\r\n"); while(bListen4Multicast) { //stay in mcast bListen4Mutlicast =0, xdot exits -> classA when terminating mcast frag# received else psoc resets xdot - wait(1); + wait_us(1000*1000); } } sleep_wake_interrupt_only(deep_sleep); //sleep until rising edge of wake signal from proc @@ -277,11 +277,12 @@ #endif if(verbose)pc.printf("\n\r lora wake detected -> monitoring i2c bus\n\r "); break; - case I2C_READ: //psoc -> xdot i2c write + case I2C_READ: //psoc -> xdot i2c write bPulseLoraWake = true; switch (buf_rcv[0]) { //switch on command # case XDOT_CMD_XMIT_PKT: //transmit data pkt case XDOT_CMD_GET_GPS: //get gps time stamp //GPS TIME !!!!!!!!!!!!! + { bool bGpsTimeRequest = false; bool bOk2XmitFullPayload = true; //if false we only transmit the mac data pkt_upstrm *pUp= (pkt_upstrm*)&buf_rcv[0]; //psoc i2c pkt @@ -465,7 +466,9 @@ } }//if joined break; + } case XDOT_CMD_SET_RADIO: + { if(verbose)pc.printf("\n\r proc cmd: CMD_SET_RADIO"); pkt_setradiodwn *pDwnRadio= (pkt_setradiodwn*)&buf_xmt[0]; pkt_setradioup *pUpRadio = (pkt_setradioup*)&buf_rcv[0]; @@ -523,10 +526,10 @@ pDwnRadio->params.dataRateCurrent = dot->getSettings()->Session.TxDatarate; //presently used data rate (adr can change this);see Lora.h pDwnRadio->params.txPowerCurrent = dot->getSettings()->Session.TxPower;//presently used tx power (adr can change this);see Lora.h pDwnRadio->params.rx1DelayCurrent = dot->getSettings()->Session.RxDelay;//presently used rx1_delay;see Lora.h - - break; + } case XDOT_CMD_GET_EUI: //0307: modified to include radio parameter settings + { if(verbose)pc.printf("\n\r proc cmd: get EUI"); pkt_eui *peui = (pkt_eui*)&buf_xmt[0]; peui->ack = I2C_ACK_PROC; @@ -540,10 +543,12 @@ peui->dataLen = sizeof(pkt_eui)-3; //size of struc minus first 3 bytes if(verbose)pc.printf("\n\r eui data length: %d",peui->dataLen); break; + } case XDOT_CMD_GET_LORAN_VER: + { if(verbose)pc.printf("\n\r proc cmd: get lorawan version"); sLoraVersion = dot->getMtsLoraId(); - if(verbose)printf("\r\nLoraVersion: %s\r\n",sLoraVersion); + //if(verbose)printf("\r\nLoraVersion: %s\r\n",sLoraVersion); pkt_eui *plorawan = (pkt_eui*)&buf_xmt[0]; plorawan->ack = I2C_ACK_PROC; plorawan->cmd = XDOT_CMD_GET_LORAN_VER; @@ -555,8 +560,10 @@ i++; } plorawan->euiData[i] = 0; - break; + break; + } case XDOT_CMD_NVM: + { if(verbose)pc.printf("\n\r proc cmd: NVM OTAA"); pkt_setnvmup *pUpNvm = (pkt_setnvmup*)&buf_rcv[0]; pkt_setnvmdwn *pDwnNvm= (pkt_setnvmdwn*)&buf_xmt[0]; @@ -571,7 +578,9 @@ pDwnNvm->bChkSumOK = 1; printNmvData(&pDwnNvm->nvmData); break; + } case XDOT_CMD_RESTORE_SESSION: //restore OTAA session + { dot->restoreNetworkSession(); dot->setDownLinkCounter(0); //reset frame counters dot->setUpLinkCounter(0); @@ -581,9 +590,11 @@ pDwnRstSession->bSetNetwrk = 1; pDwnRstSession->dataLen = sizeof(pkt_ntwrk)-2; if(verbose)pc.printf("\n\r OTAA network session restored\r\n"); - wait_ms(I2C_MIN_WAIT_DELAY); + wait_us(1000*I2C_MIN_WAIT_DELAY); break; + } case XDOT_CMD_SET_RADIO_CLASS: //multicast_change_class A or C (change only after a join!) + { if(verbose)pc.printf("\n\r proc cmd: change radio class\r\n"); pkt_setClassUp *pUpSetClass = (pkt_setClassUp*)&buf_rcv[0]; pkt_setClassDwn *pDwnSetClass = (pkt_setClassDwn*)&buf_xmt[0]; @@ -597,9 +608,10 @@ } pDwnSetClass->bSwitched = bOk; break; - + } case XDOT_CMD_SET_NTWKSESS: //read or write network session to xdot flash + { bool bWriteSession = (bool)buf_rcv[1]; if (bWriteSession) { if(verbose)pc.printf("\n\r proc cmd writing network sesion to flash"); @@ -613,6 +625,7 @@ pktwrk->cmd = XDOT_CMD_SET_NTWKSESS; pktwrk->bSetNetwrk = (uint8_t)bWriteSession; break; + } /* case XDOT_CMD_SET_KEY_X: if(verbose)pc.printf("\n\r proc cmd: this command not used\r\n"); @@ -622,6 +635,7 @@ break; */ case XDOT_CMD_GATEWAY_PING: + { if(verbose)pc.printf("\n\r proc cmd: xmit gateway ping\r\n"); pkt_ping *pPing = (pkt_ping*)&buf_xmt[0]; pPing->ack = I2C_ACK_PROC; @@ -635,14 +649,17 @@ pPing->snr = (int8_t)ping_res.snr; if (ping_res.status == 0) if(verbose)pc.printf("\r\n----------- GATEWAY PING SUCCEEDED \r\n"); - else if(verbose)pc.printf("\r\n----------- GATEWAY PING FAIL \r\n"); + else + if(verbose)pc.printf("\r\n----------- GATEWAY PING FAIL \r\n"); break; - + } default: + { if(verbose)pc.printf("\n\r proc cmd not recognized:%x",buf_rcv[0]); - wait_ms(I2C_MIN_WAIT_DELAY); + wait_us(1000*I2C_MIN_WAIT_DELAY); buf_xmt[0] = I2C_ACK_PROC; buf_xmt[1] = XDOT_CMD_UNDEFINED; + } } //switch buf_rcv[0] //gpio1 =1; //test if (bPulseLoraWake) i2c_pulse_wake(); //pulse wake-up lo->hi->lo to signal proc that xdot ready to send ack
--- a/src/multicast.cpp Wed Jul 29 01:25:20 2020 +0000 +++ b/src/multicast.cpp Wed Jul 29 05:38:19 2020 +0000 @@ -137,7 +137,7 @@ else{ multicast_change_classA(); //change back to OTAA } - return; + return true; } //======================================================================================================== //multicast_data_process()
--- a/src/wbit_util.cpp Wed Jul 29 01:25:20 2020 +0000 +++ b/src/wbit_util.cpp Wed Jul 29 05:38:19 2020 +0000 @@ -238,15 +238,17 @@ logInfo("attempts %d to join network exceeds specified attempts %d ",j_attempts,nmbAttempts); return false; } +/* getNextTxMs() not applicable to U.S. Bands // in some frequency bands we need to wait until another channel is available before transmitting again uint32_t delay_s = (dot->getNextTxMs() / 1000) + 1; if (delay_s < 2) { logInfo("waiting %lu s until next free channel", delay_s); - wait(delay_s); + wait_us(1000*1000*delay_s); } else { logInfo("sleeping %lu s until next free channel", delay_s); dot->sleep(delay_s, mDot::RTC_ALARM, false); } + */ }//while return false; } \ No newline at end of file