uart (esp8266)

Discuss game and other programming topics not specifically covered in another forum

Moderator: Programming Moderators

User avatar
crgimenes
Posts: 18
Joined: Tue Jun 06, 2017 11:36 pm

uart (esp8266)

Post by crgimenes » Thu Jun 07, 2018 9:47 pm

Hello guys,

I am trying to test the ESP8266 module using the .uart command but the AT command is not responding at all. If I connect the ESP8266 module to a usb-serial adapter on my PC I can send commands and everything works perfectly, but when I try on Next I am not receiving any response from the module. I checked everything I could think, the speed is correct and everything (8N1 115200).

I got the feeling that the system is not sending CRLF, as the module requires, but this is only a suspect, my keyboard is PS2.

When I type, I see echo on the screen, but I do not know if this echo is coming from the module or the .uart code.

I also wrote a little code using z88dk to try to talk directly to the module, but I only get the 'n' character as return ... I probably made some mistake :D

Anyone have any idea what to try next?

Code: Select all

// zcc +zxn main.c -create-app -o atomic
#include <arch/zx.h>
#include <stdio.h>
#include <z80.h>

#define TX 4923
#define RX 5179

void sendChar(char c) {
  char *txPort = (char *)TX;
  *txPort = c;
  printf("%c", c);
}

void sendString(char *c) {
  int p = 0;
  while (c[p]) {
    sendChar(c[p]);
    p++;
  }
  z80_delay_ms(200);
}

void main() {
  char *rxPort = (char *)RX;

  zx_border(INK_WHITE);
  zx_cls(INK_BLACK | PAPER_WHITE);

  sendString("AT\r\n");

loop:
  printf("%c", *rxPort);
  z80_delay_ms(20);
  goto loop;
}

User avatar
SevenFFF
Posts: 221
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: uart (esp8266)

Post by SevenFFF » Thu Jun 07, 2018 9:56 pm

Which TBU core are you on? If 31 and above, a different method is used to set the baud rate, and there is an updated version of .uart. You can't mix the two cores and the two .uart versions.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel Spectron 2084blog

User avatar
Timbucus
Posts: 230
Joined: Tue May 30, 2017 7:43 pm

Re: uart (esp8266)

Post by Timbucus » Thu Jun 07, 2018 10:13 pm

There is an error in the 0.8c distribution and the UART command has not been updated - try changing the BAUD to 38400 using the SHIFT and 11 key - that sets a prescaler for 115200 by accident! If that is the case I can send you the updated UART command.
I'm Infinite Imaginations when not in work... PAWS for thought.

User avatar
Timbucus
Posts: 230
Joined: Tue May 30, 2017 7:43 pm

Re: uart (esp8266)

Post by Timbucus » Thu Jun 07, 2018 10:14 pm

Timbucus wrote:
Thu Jun 07, 2018 10:13 pm
There is an error in the 0.8c distribution and the UART command has not been updated - try changing the BAUD to 38400 using the EDIT - SHIFT and 1 key - that sets a prescaler for 115200 by accident! If that is the case I can send you the updated UART command.
I'm Infinite Imaginations when not in work... PAWS for thought.

User avatar
Timbucus
Posts: 230
Joined: Tue May 30, 2017 7:43 pm

Re: uart (esp8266)

Post by Timbucus » Thu Jun 07, 2018 10:18 pm

You will probably find that after doing that with .UART your C code will run if you do not reset the machine - I am not sure if the Z88DK UART handling has been updated to the new method of setting the speed yet.
I'm Infinite Imaginations when not in work... PAWS for thought.

User avatar
crgimenes
Posts: 18
Joined: Tue Jun 06, 2017 11:36 pm

Re: uart (esp8266)

Post by crgimenes » Thu Jun 07, 2018 10:22 pm

Timbucus wrote:
Thu Jun 07, 2018 10:13 pm
There is an error in the 0.8c distribution and the UART command has not been updated - try changing the BAUD to 38400 using the SHIFT and 11 key - that sets a prescaler for 115200 by accident! If that is the case I can send you the updated UART command.
This is likely to be the problem, I'm using the latest version of TBU and .uart command that comes with it, I did not make changes.
As soon as I type .uart it indicates that the speed is 115200

User avatar
Timbucus
Posts: 230
Joined: Tue May 30, 2017 7:43 pm

Re: uart (esp8266)

Post by Timbucus » Thu Jun 07, 2018 10:25 pm

Yes it will show 115200 but writes the wrong value due to the new speeds - 38400 puts in a value that by accident makes 115200 or pretty close!
I'm Infinite Imaginations when not in work... PAWS for thought.

User avatar
Timbucus
Posts: 230
Joined: Tue May 30, 2017 7:43 pm

Re: uart (esp8266)

Post by Timbucus » Thu Jun 07, 2018 10:35 pm

Just posted the updated UART file on FB - hopefully you can get it from this link as Forum does not allow file uploads at the moment.

https://www.facebook.com/groups/specnex ... 732940817/

I have a new IRQ driven one available as well that I will put up this weekend.

Tim
I'm Infinite Imaginations when not in work... PAWS for thought.

User avatar
SevenFFF
Posts: 221
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: uart (esp8266)

Post by SevenFFF » Thu Jun 07, 2018 10:47 pm

Here is the updated UART on my dropbox as well, copied from FB:

https://dl.dropbox.com/s/dqmw7p8p4ay809d/UART?dl=0
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel Spectron 2084blog

User avatar
crgimenes
Posts: 18
Joined: Tue Jun 06, 2017 11:36 pm

Re: uart (esp8266)

Post by crgimenes » Thu Jun 07, 2018 10:51 pm

Now I'm getting some feedback, after the shift+1+1
Image

I would like to understand better what is happening and help if possible, the code is in some repository? github, bitbucket, gitlab, etc ...
Thank you for your help!

Post Reply