Post a new topicPost a reply Page 1 of 1   [ 10 posts ]
Author Message
 Post subject: Board Hangs At MySignals.expanderWrite
PostPosted: Fri Aug 18, 2017 6:31 pm 

Joined: Fri Aug 18, 2017 6:28 pm
Posts: 5
Hello,

I have been trying to get my HC-05 module up and running to connect the EEG, but I have continuously run into the same problem.

Every time MySignals.expanderWrite() is run, the board hangs. I know it's hanging because I have to unplug it and re-upload a new sketch at just the right moment before it crashes.

I have been debugging this for a while and know that the board in general can handle I2C communication—it's only when I put the MySignals HW ontop of it that the Wire library commands crash.

Can you let me know if there's something I can do on my end or if I need a new MySignals HW?

Thanks,

Gabriel


Top
 Profile  
 
 Post subject: Re: Board Hangs At MySignals.expanderWrite
PostPosted: Mon Aug 21, 2017 6:35 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 10492
Hello gaboosh,

could you copy the code that you are using, and some photos of your harware connection (upload them to a free image host web)?


Regards


Top
 Profile  
 
 Post subject: Re: Board Hangs At MySignals.expanderWrite
PostPosted: Tue Aug 22, 2017 7:55 pm 

Joined: Fri Aug 18, 2017 6:28 pm
Posts: 5
Hi, you can see my hardware setup here:

https://cl.ly/231U0S3L0d42

And here is my code. Note that I've added the println's to track when the program hangs. The serial prints out "3" and then does nothing. When I try to reload a new program, I have to reset the board a few times to catch it before it hangs, or else it can't upload.

Code:
#include <MySignals.h>
#include "Wire.h"
#include "SPI.h"

int8_t answer;


void setup()
{
  //Serial.begin(57600); // Communication mode baudrate with mindwave
  Serial.begin(38400);   // AT mode in HC-05 is always at this baudrate
 
  //You can use the configuration examples with the correct
  //AT+UART=**** command in order to change the baudrate

  MySignals.begin();
 
  /*
    expanderState is initialized with B10100001

    Expansor pin library names:

    EXP_3G_POWER
    EXP_ESP8266_POWER
    EXP_BT_POWER
    EXP_BT_KEY
    EXP_ADC_CS
    EXP_BLE_FLOW_CONTROL
    EXP_BLE_POWER
    EXP_ROVING_POWER
  */

  Serial.println((int)MySignals.expanderState, BIN);
 
  //Enable BT2.0 module power -> bit2:1
  bitSet(MySignals.expanderState, EXP_BT_POWER);

  Serial.println((int)MySignals.expanderState, BIN);
   
  //Enable BT2.0 Key to AT mode -> bit3:0
  MySignals.println("2");
  bitClear(MySignals.expanderState, EXP_BT_KEY); 
 
  Serial.println((long)MySignals.expanderState, BIN);
  MySignals.println("3");
  MySignals.expanderWrite(MySignals.expanderState);


  //Reset the module to enter command mode
    MySignals.println("4");

  //Disable BT2.0 module power -> bit2:0
  bitClear(MySignals.expanderState, EXP_BT_POWER);   
    MySignals.println("5");

  MySignals.expanderWrite(MySignals.expanderState);
    MySignals.println("6");

  delay(1000);
  MySignals.println("7");

  //Enable BT2.0 module power -> bit2:1
  bitSet(MySignals.expanderState, EXP_BT_POWER);   
  MySignals.println("8");

  MySignals.expanderWrite(MySignals.expanderState);
  MySignals.println("9");
 
}

void loop()
{

}


int8_t sendATcommand(char* ATcommand, char* expected_answer1, unsigned int timeout)
{

  uint8_t x = 0,  answer = 0;
  char response[500];
  unsigned long previous;

  memset(response, '\0', 100);    // Initialize the string

  delay(100);

  while ( Serial.available() > 0) Serial.read();   // Clean the input buffer

  delay(1000);
  Serial.println(ATcommand);    // Send the AT command


  x = 0;
  previous = millis();

  // this loop waits for the answer
  do
  {
    if (Serial.available() != 0)
    {
      response[x] = Serial.read();
      x++;
      // check if the desired answer is in the response of the module
      if (strstr(response, expected_answer1) != NULL)
      {
        answer = 1;
        //MySignals.println(response);
      }
    }
    // Waits for the asnwer with time out
  }
  while ((answer == 0) && ((millis() - previous) < timeout));

  return answer;
}


Top
 Profile  
 
 Post subject: Re: Board Hangs At MySignals.expanderWrite
PostPosted: Wed Aug 23, 2017 6:39 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 10492
Hello gaboosh,

Try using IDE 1.6.11. and running the codes "sensor_EEG_basic_configuration" and "BT2_0_basic_modes" without changing anything. Do these codes also cause the crash?

Don't use to debug this:
Code:
Serial.println((int)MySignals.expanderState, BIN);

only use
Code:
MySignals.println("9");


Regards


Top
 Profile  
 
 Post subject: Re: Board Hangs At MySignals.expanderWrite
PostPosted: Wed Aug 23, 2017 6:45 pm 

Joined: Fri Aug 18, 2017 6:28 pm
Posts: 5
Hi,

I ran both in 1.6.11 and sensor_EEG_basic_configuration crashes, while BT2_0_basic_configuration outputs:

Code:
AT
Error
AT
AT
AT
AT


Thanks,

Gabriel


Top
 Profile  
 
 Post subject: Re: Board Hangs At MySignals.expanderWrite
PostPosted: Thu Aug 24, 2017 6:49 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 10492
Hello gaboosh,

what Operative System are you using in your PC? Could you try in Linux Ubuntu?
In the other hand, could you try with a normal Arduino Uno, not SMD edition?

Regards


Top
 Profile  
 
 Post subject: Re: Board Hangs At MySignals.expanderWrite
PostPosted: Thu Aug 24, 2017 9:10 pm 

Joined: Fri Aug 18, 2017 6:28 pm
Posts: 5
Hello,

I tried 1.6.11 on Ubuntu and it had the same exact result as on the Mac.

I have ordered a new R3 Uno but it won't be here until Saturday.

I absolutely must have an EEG solution by Wednesday, 30 August. 24 hours between communication is not working. If this does not work by Wednesday, I will be returning the EEG and BT module for a full refund.

Thank you,

Gabriel


Top
 Profile  
 
 Post subject: Re: Board Hangs At MySignals.expanderWrite
PostPosted: Fri Aug 25, 2017 9:18 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 10492
Hello gaboosh,

We will analyze this problem carefully, we will keep you informed.

Regards


Top
 Profile  
 
 Post subject: Re: Board Hangs At MySignals.expanderWrite
PostPosted: Sun Aug 27, 2017 4:20 am 

Joined: Fri Aug 18, 2017 6:28 pm
Posts: 5
Hello,

I just received my Uno R3 and am getting the same exact result.

Please note that when I don't have your board attached to the Arduino, the code runs fine. It is only when your board is attached.

Gabriel


Top
 Profile  
 
 Post subject: Re: Board Hangs At MySignals.expanderWrite
PostPosted: Tue Aug 29, 2017 7:19 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 10492
Hello Gabriel,

Please continue the conversation with our sales agent, thank you.

Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 10 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.