esp8266 AT commands embedded code

Go To Last Post
64 posts / 0 new

Pages

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For a ring buffer to use maybe take a look at:

 

http://www.fourwalledcubicle.com/files/LUFA/Doc/120219/html/group___group___ring_buff.html

 

The entire code for it is in a .h file - no need for a .c file even...

 

https://github.com/abcminiuser/lufa/blob/master/LUFA/Drivers/Misc/RingBuffer.h

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well the code provided by awnil works about 60-70 percent .... U can see in the following pics.

 

 

Output when i send AT COMMAND.

 

 

 

Output when i send AT + GMR command

 

 

So now i am getting Response which us full of garbage values .... 

I am now very frustrated i am trying this thing from over 2 months and still not happening.. really thinking to drop this thing .... 

Kunal Gupta

github.com/gkunalupta

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you thought to Google what might be causing your problem? There have been a zillion people that have done much the same as you want to do and been successful.
With a little research you might find how to wire the esp8266 properly - it requires a fair amount of current. Otherwise it is very unreliable. Does this sound similar to what you are observing?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have googled many times..seen almost every link...but didn't get any satisfaction and resource full link for this.
U are saying that many people have done this but find only one source code for this task( searched both on google and github) and that when i run and dry run it is not running and satisfactory.
So if i have any person who bas done similar thing like this or source code then can u give thier ulrs or info.

Kunal Gupta

github.com/gkunalupta

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kunalgupta wrote:
the code provided by awnil works

I didn't provide any complete code - just an outline of the ISR - there were parts left for you to fill in!

 

So you need to show your completed code.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I believe sir, without following too deeply into all the code and replies above, that you are in what could be called a "side effects loop".  This is a situation where there are two basic software problems in a system.  And changing one problem in order to fix or diagnose it causes the other problem to change how it is preventing the system to work.   However in this situation, there are four problems:   

   -- the developer lacks an understanding of how the AVR and ESP are linked.

   -- the developer lacks a deep understanding of how the AVR works internally.

   -- the developer lacks a deep understanding of how the ESP works internally.

   -- the developer lacks a basic understanding of how the ESP is programmed and controlled using AT commands.

 

I recommend that you reconsider your refusal to use the Arduino system. The Arduino system can hold and lock three of the problems above into fixed and unchanging states.  Then the developer can adjust software and parameters of the fourth problem alone and compare the results obtained with those published in various on-line tutorials concerning Arduino/ESP development.  Arduino is an international standardized platform for the development of AVR hardware and software on a level that is much easier to work with than the tools provided by Microchip for best use by professional and experienced microprocessor engineers.

 

    Arduino hardware in the form of UNO, ProMini, and Nano clones are sold on eBay for a few dollars each.   Every AVR developer in the world should have at least one, along with a Saleae-type Logic Analyser clone (which sells for about $10 US).

 

    If you are forbidden by your school's teachers or your company's boss from using Arduino in the final homework project/product, then you have a multi-stage development process to go through.  First get your prototype working with Arduino, and then convert the Arduino code, hardware, and development tool chain to specifications demanded by your teacher or boss.

  

   Presently, you seem to be going around in circles on this project.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta .. i will suggest you to go through the above code and reply so that u can get to know how much knowledge i have for all the 4 points u raised.
I don't know what led to conclude these 4 points

And other thing for using Arduino uno... I have done that thing and that works perfectly using hardware serial library and i think i have mentioned that earlier also, here my concern is to learn the.embedded c programming and sharp my skills for firmware programming of different pheriferals like UART ...this project is not given to me by anybody i am doing on my own with aim of learning things and getting knowledgeable and experience and if get this task then I can develop whole library for esp8266 and 32 both with AT commands which will overall i think give me lots of new things to know and that's how i can learn embedded c .
Though task is still not completed but still from the point of view of learning i got to know many things and that is what my main concern is right now.

Kunal Gupta

github.com/gkunalupta

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, on this occasion  Simonetta  is right - you are trying to do too many things at once!

 

As I said in #21 and #23, you need to keep it simple!

 

In his tutorial, 'Help! It doesn't work!', Kartman wrote:
3. Ask yourself “how many problems do I want to solve at once”? The answer should be one. Trying to solve more than one problem at a time is a recipe for failure.

 

https://www.avrfreaks.net/forum/help-it-doesnt-work

 

If you do want to spend time in mastering the low-level nitty-gritty of the AVR UART, then concentrate on just that:

 

  • Just use a simple, direct, wired connection from the AVR to a PC with a terminal app.
     
  • Get rid of all other complications - bluetooth, ESP, etc, etc.

 

By now, you have the pieces to make an Interrupt Service Routing which feeds a ring buffer.

 

If you go to the AVR Product Page, you will find another example of doing that.

 

https://www.avrfreaks.net/commen...

 

https://www.avrfreaks.net/commen...

 

Look for the Application Note AN_1451 - "AVR306: Using the AVR UART in C on tinyAVR and megaAVR devices"

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys i found one thing regarding this ,

Prime reason for Data over run error is different baud-rates of two communicating modules ( here atmega2560 and esp8266) .

So now when i ran into the datasheet of atmega2560 , i found it can go maximum upto 111,111.11 baudrate as per the formula given in the datasheet for calculating the baud-rate to get 115200.

So What i think this can be the reason for  not receiving the response .

 

Any suggestions or views on this ???

 

 

Also one other thing how  can i upload code in Atmega 2560 from Atmel studio by

UART serial communication using FTDI adapters like 1) normal Arduino USB Cable  type A/B or with 2) FTDI 232rl Serial module.

PS 

1) Bootloader program is installed in controller 

2) I have seen the AVRDUDE, But their i didnt found any command For selecting FTDI adapters.

Kunal Gupta

github.com/gkunalupta

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kunalgupta wrote:
Prime reason for Data over run error is different baud-rates

No, it isn't.

 

Wrong baud rate would give you garbage data and/or Framing errors.

 

Kunalgupta wrote:
Also one other thing how  can i upload code in Atmega 2560 from Atmel studio by

UART serial communication using FTDI adapters like 1) normal Arduino USB Cable  type A/B or with 2) FTDI 232rl Serial module.

PS 

1) Bootloader program is installed in controller 

2) I have seen the AVRDUDE, But their i didnt found any command For selecting FTDI adapters.

That's an entirely different topic - nothing to do with the topic of this thread.

 

Besides, you've already asked it here:  https://www.avrfreaks.net/forum/uploading-code-through-uart-avr-controller-atmel-studio-70 - and had a follow-up question there.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah i mean that my buffer gets full because of which data over run error occurs and buffer gets full because i am receiving data from esp8266 at higher baudrate ( 115200) and atmega2560 is able to receive that data at 111,111.11 . So before the atmega2560 receive buffer is emptied new data comes in because of this difference .

Kunal Gupta

github.com/gkunalupta

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kunalgupta wrote:
my buffer gets full

No, not your buffer - the AVR's internal buffer.

 

Kunalgupta wrote:
buffer gets full because i am receiving data from esp8266 at higher baudrate ( 115200)

No.

 

You set the AVR to a certain baud rate, and it will sample the incoming data at that rate.

 

Again, if that sampling does not match the proper baud rate at which the data was sent, then you will get garbage - you will not get the data any faster than the AVR's programmed rate.

 

Kunalgupta wrote:
So before the atmega2560 receive buffer is emptied new data comes in because of this difference

No - see above.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi to all,

 

So i have finally done this thing , took some break from this task and then get back to it and designed the AT Commands firmware for esp8266 .

Concept of Ring buffer and queues help me to record the responses 

 here is link of this thing

 

 

https://www.linkedin.com/posts/k...

Kunal Gupta

github.com/gkunalupta

Pages