Author Topic: Connect an Adafruit Feather (nRF52 Bluefruit LE - nRF52832) to an ESP8266-01  (Read 2154 times)

0 Members and 1 Guest are viewing this topic.

Offline Prince1819Topic starter

  • Newbie
  • Posts: 5
  • Country: pt
Hi,
My team and I were trying to connect an Adafruit Feather (nRF52 Bluefruit LE - nRF52832) to
an ESP8266-01 through serial connection.
The process is the following:
1. A bunch of sensors send data to the Adafruit Feather.
2. The Feather sends all the data via serial communication to the ESP8266-01.
3. Then the ESP sends all to a server.
We are having problems in the communication between the Feather and the ESP. For several
weeks we tried to code for ourselves and then after lots of failures, we advance for pre-done
codes found on forums, but no one was working, at least with our hardware.
Did someone had the same problem? If yes, how did you solved it?
Best regards,
Paulo Andrade
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 6769
  • Country: va
Might help if you say what the symptoms of it not working are, and what you're actually doing in the way of transferring the data. Otherwise there are a zillion things it could be, 99% of which won't be appropriate to your particular situation.

So:

1. What is the serial connection? Speed, format, etc?
2. Are you sending known data (so you can check it at various points) or is it opaque to you?
3. Do you see that data exiting the Feather, on the wires?
4. Does the ESP read whatever is on the wire properly?
 

Offline Prince1819Topic starter

  • Newbie
  • Posts: 5
  • Country: pt
Might help if you say what the symptoms of it not working are, and what you're actually doing in the way of transferring the data. Otherwise there are a zillion things it could be, 99% of which won't be appropriate to your particular situation.

So:
 
1. What is the serial connection? Speed, format, etc? -> Baud Rate: 9600; Type: UART
2. Are you sending known data (so you can check it at various points) or is it opaque to you? -> We are sending a temperature from a atmospheric sensor
3. Do you see that data exiting the Feather, on the wires? -> Yes
4. Does the ESP read whatever is on the wire properly? -> No, in the website we get random numbers or characters
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 6769
  • Country: va
OK. Just to be sure, I would ignore the sensor and use fake data, so I know the exact pattern that should appear on the wires. And then verify that the data does indeed show on the wire exactly as expected. The problem with sensor data is that it changes, and whilst you might be able to say that the ultimate numbers aren't what's being transferred, it's hard to say what they should be. It's also easier to spot things like reversed bits, 7-bit data, etc.

Next, do the same for the ESP->server connection. That is, fake the data being sent to the server with something you can easily verify and check that it does indeed come out the other end properly. Sorry if you've already done this but without knowing if you have it's worth pointing out.

Assuming both the above verify correctly, the problem has to be in the ESP, so it's just a matter of intercepting the (still known, fake data) in the receive function and then working towards the server sending stuff until it is wrong.

How are you programming this (that is, what language)?

 

Offline Prince1819Topic starter

  • Newbie
  • Posts: 5
  • Country: pt
I actually already tried to send "fake data". I defined a string (example: "1234") and then tried to send it via serial communication.
With an oscilloscope I measured the wave form and it was ok, it was what I expected. The ESP simply didnĀ“t read anything. That made me think that might have been some prblem with the TX-RX ports of the ESP but I can program it with no worries.

 

I am using Arduino IDE (C++) with a programming board to program it

Best regards
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 6769
  • Country: va
I think you need to start at the serial port ISR and work your way up to where the data stops appearing. I would consider putting money on the ISR, or however the hardware is read, being a good suspect.

From what you've said I assume you're using the Arduino IDE thing. On the one hand that's useful because stuff is already done and proven to work, but on the other you don't really know what it's doing (or not!) when it fails. I think you need to get your hands dirty in there.
 

Offline Prince1819Topic starter

  • Newbie
  • Posts: 5
  • Country: pt
We actually tried that way and it still didn't work
best regards
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 6769
  • Country: va
It sounds like the serial port driver is being configured for the wrong port or pins. However, there is an assumption that when you say you can program it OK you mean you used the same serial driver code to get data in and out. If not, then that's the place to look - just run up a very basic app that does nothing except read and write the serial port using the same code as in your project that fails. It should be simple enough that you can post the code here or somewhere (which, to be honest, would have been useful back at the start).
 

Offline Prince1819Topic starter

  • Newbie
  • Posts: 5
  • Country: pt
We actually tried using that piece code and from pc to ESP, it works fine, but from a microcontroller (Example: Arduino) to ESP it doesn't work. We look up for any error in the Arduino code and it was ok. If i program an arduino with the ESP code, it receives all the data sent over.
 
 We used this piece of code:

/*
 ESP8266 Serial Communication
 
 The blue LED on the ESP-12 module is connected to GPIO2
 (which is also the TXD pin; so we cannot use Serial.print() at the same time)
*/

 

void setup() {
  Serial.begin(9600);     // Initialize the Serial interface with baud rate of 9600
}

 

// the loop function runs over and over again forever
void loop() { 
  if(Serial.available()>0)    //Checks is there any data in buffer
  {
  //  Serial.print("We got:");
    Serial.print(char(Serial.read()));  //Read serial data byte and send back to serial monitor
  }

 

}
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 6769
  • Country: va
Is the ESP serial polarity correct? I could imagine a scenario where it would work with the PC but not a micro if the PC output was inverted (as it would be for V.24).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf