Intermittent random connection problems between the DK and the Gateway shield or the iOS app


#1

Ok, here I am again friends,
this issue has been plaguing me since i got my first DK’s
I thought it was me doing something wrong, but it still happens.
Often , after a power down of the board, and is turned back on, the board will blink green slowly, but in reality is not advertising. It can’t be found in the app nor will it connect to a nearby gateway shield, there is no way of getting it connected to the cloud.
The only way to get it back to life is to factory reset it (pressing and holding until after the yellow dfu flash) and wait for it to flash magenta at that point it will be visible to the app of the GW shield.
I have done this umpteen times, and it is extremely frustrating.
Any ideas?


#2

can you post your user code? does this happen with a blank sketch or something like tinker?


#3

anything at all, nothing specific comes to mind but very simple code.
I’m just working on simple data logging, and seeing how the DK’s are different with respect to the Photon, before trying to port the more complex sketches I have developed for the Photon.
this is what’s on it now

float temp,read,voltage;

void setup()
{

pinMode (A0, OUTPUT);

}

void loop() {

if (millis() % 3000  < 100) {
    
    get_temp();
    voltage = (analogRead (A0)/804*3.3);
    Particle.publish("tmp36",String(temp,2),60,PRIVATE);
    delay(1000);
    Particle.publish("volts",String(voltage,2));
    delay(1000);
    Particle.publish("analog",String(read),60,PRIVATE);
    delay(1000);
}

System.sleep(SLEEP_MODE_CPU);

}

void get_temp () {

read = analogRead(A0);
voltage = read/10233.3;
temp = (voltage
100)-50;

}


#4

There is a bug in 1.1.47 where if you call Particle.publish before you are connected, then bad things happen. The simple way to fix this is to wrap it in a check for cloud connectivity, as follows:

if (Particle.connected()) {
 Particle.publish(“This will work…”, “…and won’t cause connectivity issues”);
}

This is already fixed in the develop branch, so if you are compiling locally and using the binaries from there, the check isn’t necessary anymore. Though with bluz you are not guaranteed to be connected to the cloud like with the Photon, so you may want to react to that case somehow if your app needs to (stash the data, for instance, so you can send it once you are connected)


#5

ok im familiar with delayed transmission,

I usually use two dimensional char arrays and publish from a for loop when connection is active.
Now,… if i could just get that developer firmware flashed!

looking for gcc on brew for mac… no idea how to install or where to place the version you sent me on the other thread!


#6

PS

also i think the voltage readings are a little out of whack… i am getting an analogread of 226 (0.73v) on a 0.78 volt reading from my tester… I know that doesn’t sound like much but it is a 5 degree difference on an analog TMP36 temperature probe.


#7

What I do is just have a folder with the compiler and then add the path to the bin/ folder as an environment variable. So i download the version I need and add the location to the path like this:
PATH=$PATH:/usr/local/gcc-arm-none-eabi-4_9-2015q2/bin/

That way you just download it, add the location to the path when you need it (or when you want to change versions) and you don’t have to install anything.


#8

did that

still getting errors

arm-none-eabi-gcc: fatal error: no input files
compilation terminated.
Luigis-MacBook-Pro:modules gigi$ make clean all PLATFORM=bluz -s program-dfu
/Users/gigi/Downloads/firmware/modules/bluz/system-part1/makefile /Users/gigi/Downloads/firmware/modules/bluz/user-part/makefile
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
text data bss dec hex filename
97512 312 5324 103148 192ec …/…/…/build/target/system-part1/platform-103-m/system-part1.elf
make[1]: dfu-suffix: No such file or directory
make[1]: *** […/…/…/build/target/system-part1/platform-103-m/system-part1.dfu] Error 1
make: *** [/Users/gigi/Downloads/firmware/modules/bluz/system-part1/makefile] Error 2
Luigis-MacBook-Pro:modules gigi$


#9

You don’t need the dfu portion, your make line only needs to be:

make PARTICLE_DEVELOP=1 PLATFORM=bluz APP=tinker


#10

Thanks eric that did it, this version should have the corrected time and i2c functionality?


#11

Yup, all the latest and greatest are in the develop branch. However, that could also mean there are a few issues in there since it isn’t fully tested. We recently merged the newest Particle firmware into this branch and have found a few issues since, so consider yourself a beta tester!


#12

ok… is this right?

Luigis-MacBook-Pro:bluz gigi$ particle get Bluz_3 version
1.1.47

1.1.47 can be installed from the webide…


#13

We haven’t updated the version number yet since we haven’t officially release anything, so the version will still report as 1.1.47.

When you compile locally, you need to upload both the system and user parts, both need to be flashed. As long as you send over system-part1.bin and tinker.bin (or whatever your app is called + .bin) then you should be good


#14

so I can’t flash from the web ide…
how do i go about putting my code in?

my .ino file…


#15

you can create a folder under user/applications/ for your app. Name it whatever you would like, and then create a file inside there with a .cpp extension. Your code goes inside that file. When, when you compile, point the make file to it by specifying APP=


#16

tried that moved my .ino file… renamed to cpp

got these errors… maybe can’t compile .ino’s

this is an excerpt

void setup()’:
applications/myapp/myapp.cpp:8:10: error: ‘A0’ was not declared in this scope
pinMode (A0, OUTPUT);
^
applications/myapp/myapp.cpp:8:14: error: ‘OUTPUT’ was not declared in this scope
pinMode (A0, OUTPUT);
^
applications/myapp/myapp.cpp:8:20: error: ‘pinMode’ was not declared in this scope
pinMode (A0, OUTPUT);
^
applications/myapp/myapp.cpp: In function ‘void loop()’:
applications/myapp/myapp.cpp:14:16: error: ‘millis’ was not declared in this scope


#17

ah, sorry, one more step. you need to intluce application.h, so add this to the top of your file:

'#include application.h


#18

Thanks ill try tomorrow too tired now…
Going to sleep night!


#19

Another thing to watch out for, the webIDE reads the code and adds in some forward declarations for functions. That doesn’t happen with local building, so you will need to declare your functions before they are called.
So for your code above just add this line before setup
void get_temp(void);


#20

I have given up.
Local compiling is too much of a hassle,
You also need to download and copy all external libraries and files.

I have put the bluz away in my drawer and continue to develop on the photon and just Wait for the release to be available in the web ide , not too ar away in the future I hope.