Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working properly with combination of spi Slave mode #8

Open
barmy-berg opened this issue Feb 3, 2020 · 0 comments
Open

Not working properly with combination of spi Slave mode #8

barmy-berg opened this issue Feb 3, 2020 · 0 comments

Comments

@barmy-berg
Copy link

hi,
i am trying to send 6 data(uart mode 9600) to bolt cloud using arduino and bolt module. Arduino is getting 6 data in array in spi slave and transferring them to cloud. problem is , all data getting uploaded except first and sixth.
the code will upload all data properly, if i don’t use spi.
Please suggest , is there any problem with arduino code or any bug with bolt cloud
#include <SPI.h>
#include <BoltIoT-Arduino-Helper.h>
int b[6],i=0;
bool cloudMode=true;
void setup (void)
{
boltiot.begin(Serial);
Serial.begin (9600);
SPCR |= bit(SPE); /* Enable SPI /
pinMode(MISO, OUTPUT); / Make MISO pin as OUTPUT */

SPI.attachInterrupt(); /* Attach SPI interrupt */
}

void loop (void)
{
cloudMode=boltiot.processPushDataCommand(b[0],b[1],b[2],b[3],b[4],b[5]);
if (cloudMode){
SPI.attachInterrupt();
}

}

// SPI interrupt routine
ISR (SPI_STC_vect)
{
cli();

byte c = SPDR;
b[i]=c;
i++;
Serial.println(c);
if (i==6){
i=0; cloudMode=false;
SPI.detachInterrupt();
}

}

In downloaded excel sheet the first parameter copies data from second parameter and last 5 parameter is correct.
where as on browser first and sixth parameter is not plotting.
please suggest, where i am making mistakes.
Thanks in advance
Capture2
Capture3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant