ESP8266 to 08M2 via serrxd

Hooter

Senior Member
Folks - I am attempting to send serial data from an ESP8266 to an 08M2 via the serial in pin using the serrxd command.
Both devices are running on 3.2vdc. I can receive the data from the ESP perfectly on the 08M2 if I use any other pin and
the serin command at 4800bd but I receive nothing using the serrxd on pin C.5. I have included and excluded the 10k and
22k resistors to no avail. Could anyone suggest what I am doing wrong please.
Cheers
 

Hooter

Senior Member
Suggest you check out this thread, especially Hippy's comment in #14 regarding DISCONNECT.
Thanks for the response Pongo. I did check previous posts and the manual which states that the Disconnect is auotomatic when the serrxd is issued
but I will try as you suggest tonight. Ta
 
Last edited:

hippy

Technical Support
Staff member
I believe the ESP chips have UART output which is idle high. Feeding that into the PICAXE Download Serial In will keep the PICAXE in a 'download expected' reset state and prevent the PICAXE program running. The PICAXE never reaches the SERRXD command which prevents this from happening.

Also, SERRXD expects an idle low input so it cannot be used to read the ESP serial, but one can use a SERIN on the Download Serial In after a DISCONNECT.

It may be possible to make it work with a resistors and a diode -
Code:
                 .--------|>|--------.
                 |                   |
.-----.    1K    |   .-----_-----.   |
|     |    __    |   | V+     0V |   |
| ESP |---|__|---^-->| C.5   C.0 |---'
|     |              | C.4   C.1 |
`-----'              | C.3   C.2 |
                     `-----------'
Code:
PowerOnReset:
  Disconnect
  High C.0

MainLoop:
  Do
    SerIn C.5, T4800, ...
    :
  Loop
 
Last edited:

Hooter

Senior Member
I believe the ESP chips have UART output which is idle high. Feeding that into the PICAXE Download Serial In will keep the PICAXE in a 'download expected' reset state and prevent the PICAXE program running. The PICAXE never reaches the SERRXD command which prevents this from happening.

Also, SERRXD expects an idle low input so it cannot be used to read the ESP serial, but one can use a SERIN on the Download Serial In after a DISCONNECT.

It may be possible to make it work with a resistors and a diode -
Code:
                 .--------|>|--------.
                 |                   |
.-----.    1K    |   .-----_-----.   |
|     |    __    |   | V+     0V |   |
| ESP |---|__|---^-->| C.5   C.0 |---'
|     |              | C.4   C.1 |
`-----'              | C.3   C.2 |
                     `-----------'
Code:
PowerOnReset:
  Disconnect
  High C.0

MainLoop:
  Do
    SerIn C.5, T4800, ...
    :
  Loop
Thanks for that Hippy. I will give that a try. It may be easier for me to reallocate my pins or upgrade to a 14M2.
Thanks again.
 

AllyCat

Senior Member
Hi,

Alternatively, the 10k "pull-down" resistor on the programming pin (c.5) can be a much higher value (the resistance is already 32k when the 22k series resistor is included) and still allow the PICaxe to boot correctly. Therefore, if you want to maintain the capability to program the PICaxe on-board, then increase the 10k to at least 100k or more and connect the ESP output pin via a diode to the PICaxe (anode to c.5). Then the PICaxe can boot and/or be programmed normally, because the diode is reverse biassed.

For the program to receive data from the ESP, first issue a DISCONNECT and then activate the internal "Weak Pullup" resistor on c.5 (typically 30k). This needs a POKESFR WPUA , 32 command because the PULLUP command is blocked for that pin (sorry I can't recall the value of WPUA but it shouldn't be difficult to find, if required). This pulls c.5 to Idle High , which the ESP can pull low via the diode when required.

Thus, you can receive serial data using the SERIN command on c.5 (although some of the documenattion incorrectly implies that you can't), or even issue another POKESFR command to the "Alternate Pin Function" register (APFCON) which allows the HSERIN communications hardware to be connected to c.5 (Idle-High only).

Cheers, Alan.
 
Top