Page 1 of 2

uart (esp8266)

Posted: Thu Jun 07, 2018 9:47 pm
by crgimenes
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;
}

Re: uart (esp8266)

Posted: Thu Jun 07, 2018 9:56 pm
by SevenFFF
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.

Re: uart (esp8266)

Posted: Thu Jun 07, 2018 10:13 pm
by Timbucus
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.

Re: uart (esp8266)

Posted: Thu Jun 07, 2018 10:14 pm
by Timbucus
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.

Re: uart (esp8266)

Posted: Thu Jun 07, 2018 10:18 pm
by Timbucus
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.

Re: uart (esp8266)

Posted: Thu Jun 07, 2018 10:22 pm
by crgimenes
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

Re: uart (esp8266)

Posted: Thu Jun 07, 2018 10:25 pm
by Timbucus
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!

Re: uart (esp8266)

Posted: Thu Jun 07, 2018 10:35 pm
by Timbucus
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

Re: uart (esp8266)

Posted: Thu Jun 07, 2018 10:47 pm
by SevenFFF
Here is the updated UART on my dropbox as well, copied from FB:

https://dl.dropbox.com/s/dqmw7p8p4ay809d/UART?dl=0

Re: uart (esp8266)

Posted: Thu Jun 07, 2018 10:51 pm
by crgimenes
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!