Announcements

Equip yourself to optimize PSoc4 MCUs for Evs at the EV Webinar. Click here to register.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4 Forum Discussions

psco_3295286
Level 4
Level 4
10 likes given 5 likes given First like received

Hello,

I am trying to interface CY8C4245AXI-483 with ESP8266. The code is attached below.

As per my knowledge, the code should get the ip address and also return string 'welcome' , but there is nothing displayed on the serial terminal.

H/W connections apart from GND are :

MCU tx - ESP rx, FTDI rx

MCU rx - ESP tx, FTDI tx

Also, FTDI 3.3 V is given to ESP module.

Please let me know what should be done to at least establish communication between wifi module and MCU.

Thank you.

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Hi,

I tried your project using CY8CKIT-042.

I connected UART_1 to the KitProg's 12[6] and 12[7] and connected to a TeraTerm named "UART_1"

UART to my FTDI USB-Serial converter and Connected a TeraTerm named "UART"

At first when I ran your program,

I could see only

AT_C

then after reset I saw

IFSR

It seems that the UART is sending only 4 bytes,

so I checked your UART component Configuration

001a-UART_Config_orig.JPG

I noticed that TX buffer size was set to 40!

So I changed it to 4

001-UART_Config.JPG

Now after starting the program, I could see

AT+CIFSR

in UART.

So after restarting the program and saw "AT+CIFSR" I typed "Ready" and a Enter key.

Then WELCOME was shown.

And in the UART_1 TeraTerm my "Ready" was written.

003-UART.JPG

002-UART_1.JPG

moto

View solution in original post

22 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Please ensure that the GND pin of ESP8266 module is connected to CY8C4245AXI-483 device ground.

For example project on interfacing PSoC with ESP8266, please go through the following web page.

Cypress PSOC 4 + ESP8266 WS2812 RGB XMAS Lights | Hackaday.io

Thanks

Ganesh

I have already connected GND.

I tried again and found that for    'UART_PutString("AT+CIFSR\r\n");'    serial terminal shows random values like EB, FC etc

and code stops at    'while(!HaveAnswer) Wait();'   so I suppose there is no answer from device.

Kindly suggest what should be done.

Thank you.

0 Likes
MotooTanaka
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Hi,

I tried your project using CY8CKIT-042.

I connected UART_1 to the KitProg's 12[6] and 12[7] and connected to a TeraTerm named "UART_1"

UART to my FTDI USB-Serial converter and Connected a TeraTerm named "UART"

At first when I ran your program,

I could see only

AT_C

then after reset I saw

IFSR

It seems that the UART is sending only 4 bytes,

so I checked your UART component Configuration

001a-UART_Config_orig.JPG

I noticed that TX buffer size was set to 40!

So I changed it to 4

001-UART_Config.JPG

Now after starting the program, I could see

AT+CIFSR

in UART.

So after restarting the program and saw "AT+CIFSR" I typed "Ready" and a Enter key.

Then WELCOME was shown.

And in the UART_1 TeraTerm my "Ready" was written.

003-UART.JPG

002-UART_1.JPG

moto

I changed ascii instead of hex in my 'receive' part of serial monitor and now I am getting 'welcome' etc strings.

Also, I have made changes in the tx buffer size as per your suggestion.

But there is no communication between esp8266 and mcu, as the code execution doesn't go beyond   ' while(!HaveAnswer) Wait();'

If my code is ok, are there any changes required in the hardware?

Thank you.

0 Likes

Hi,

I'm glad to hear that you are now receiving strings OK.

Since I don't have esp8266, I can't try it on my side,

I would suggest you try the following.

(1) Connect esp8266 to the USB-UART (FTDI) and type commands from your terminal program

and note the exact letters you are sending and receiving. (PC <-> esp8266)

(2) Connect PSoC and USB-UART to PC and emulate esp8266 from your second terminal program (UART)

    I suppose that you will find that your program is not writing or answering the strings just like (1)

  (PC <-> PSoC)

(3) Modify your program to generate/expect exactly the same strings you noted in (1)

Hopefully, by doing these, the situation will get better.

Meantime I would add some timeout for the wait loop so that the program can retry.

moto

Hi,

I am not sure whether I have performed the steps you have suggested properly or not. The psoc-pc communication is working (step 2).

But I am still having issue with interfacing esp8266.

Please guide.

Thanks.

0 Likes

Hi,

All I can help is something to do with PSoC and I have no knowledge about esp8266 nor what you want to do with that device.

Having written above, have you tried the step (1)?

What did you sent from your Terminal program.

And what was the response from the device?

Would you provide me some (expected) sample conversation between PSoC and esp8266?

Such as

=================

PSoC > AT+CIFSR[EOL]

ESP8266 > Ready[EOL]

=================

Note: [EOL] can be '\n', '\r' or "\n\r" ...

moto

The serial monitor doesn't detect the com port when I plug in the kit programmer for UART_1.

Although the com port with ftdi for UART is identified.

0 Likes

Hi,

I assume that you are using CY8CKIT-042.

Then you need to jumper connect

UART_1:rx P4[0] to KitProg's tx 12[7]

UART_1:tx P4[1] to KitProg's rx 12[6]

Meantime, if you are using KitProg,

your PC should detect COM port

even if the jumpers are not connected.

If it's the case, please download PSoC Programmer from the URL below

and update firmware of your kit. (From Utilities Tab > Update Frimware)

https://www.cypress.com/documentation/software-and-drivers/psoc-programmer-archive

010-PSoC_Programmer.JPG

moto

Yes I am using CY8C4245axi-483.

I have separated upper part of cy8ckit-059 to program the mcu.

Also, I have used jumpers to connect pins12(6), 12(7) to UART_1 and ftdi is connected to UART.

0 Likes

Hi,

You wrote that the KitProg is not detected from your PC.

When you connect the KitProg, do LEDs on the KitProg light?

Mine (taken from CY8CKIT-043) lights LED3 Green and Power Orange.

And my PC is detecting the COM port even the KitProg is not connected to other MCU.

If none of the LEDs are lit, may be there is a problem in connection or the KitProg.

moto

Both the power LED and LED3 light up. Only the com port is not identified.

0 Likes

Hi,

Is the Green LED blinking?

If so, please push RESET button and keep it for 5 seconds or so.

moto

Hi,

I kept the reset button pushed for a few seconds and it worked. Now the com port is identified.

And I managed to perform what you had done in previous answers, i.e. writing ready and pressing enter will display 'welcome' and 'ready' on 2 different com ports.

Thanks.

Now, the main question is regarding communication with esp8266, which is still unsolved.

When I connect esp8266, the blue led flashes, but the red one doesn't glow.

Is it possible that the module is corrupted, or it is not getting enough current?

How can I check it?

Thanks in advance.

0 Likes

Hi,

I referenced the following URL

https://components101.com/wireless/esp8266-pinout-configuration-features-datasheet

In the section of How to use the ESP8266 Module

it is written

"The ESP8266 module works with 3.3V only, anything more than 3.7V would kill the module hence be cautions with your circuits."

So if you have connected 5V to VCC, you could have broken the module.

In the ESP8266-01 Boot Option section

If you want to use the module in UART Mode you need to connect

GPIO-0 Low

GPIO-2 High

moto

Well I have set GPIO-0 - 0 and GPIO-2 - 1 and also supplied the module with 3.3V from ftdi.

But it might be possible that I accidently applied 5V in one of the trials, which caused esp to burnout.

I shall check whether the module is receiving 3.3 V or not and then get back to you.

Thank you.

Hi,

Some ESP8266-01 which I ordered for this discussion arrived last night.

After some struggle, I found that

(1) To use AT command,  following config was required

GPIO-0 High

GPIO-2 High

(2) Tera Term Setting

Setup > Terminal

New-line

Receive: AUTO

Transmit: CR+LF

Coding (receive): UTF-8

Coding (transmit): UTF-8

Note: locale does not need to be japanese.

020-TeraTerm-Setup-Terminal.JPG

Setup > Serial port

Note: I needed add 1msec/char and 10 msec/line in Transmit delay

021-Serial-port.JPG

The following is my test

I used CY8CKIT-042 as USB-Serial converter and reset switch,

I connected

ESP8266-01 - CY8CKIT-042

PIN 1 (GND) - GND

PIN 2 (GPIO-02) - 10Kohm - V3.3

PIN 3 (GPIO-02) - 10Kohm - V3.3

PIN 4 (RXD) - P12[7]

PIN 5 (VCC) - V3.3

PIN 6 (RST) - RESET

PIN 7 (CH_PD) - 10Kohm - V3.3

PIN 8 (TXD) - P12[6]

After pushing RST (sw1) of CY8CKIT-042

In Tera Term I selected

Control > Reset Terminal

Edit > Clear Buffer

Then I typed

AT[Enter]

AT+GMR[Enter]

022-Tera-Term-log.JPG

moto

Hi,

Thank you for suggestions.

I have made all the changes you mentioned but not able to display version of at commands and other things.

I will check again for any mistakes on my part and will replace the esp8266 with wemos d1 mini board ( with esp8266-12 inside) in case the module is corrupted.

0 Likes

Hi,

Please note that the module I purchased and tested was ESP8266-01,

so the behavior may be different from yours.

I found the following URL for the AT Instruction Set of ESP8266.

https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf

Meantime, there is a chance that you have already programmed your module for other application(s),

in such case, the behavior of the module is up to the application you programmed in the module.

Anyway, IMHO, the first thing you need to accomplish is to make sure that the module

responses to/from the command from UART.

And you must make sure that the command sent and response received using

ESP8266-Module <-> USB-Serial <-> PC

is working.

If this path is not working, software of PSoC has no chance to make it work.

moto

Hi,

You mean to say that esp module should response to at commands, i.e. return version of at if AT+GMR is typed or return local ip address if AT+CIFSR is typed?

And yes, I have also used ESP8266-01, but it is most likely that the module is burnt so I am thinking of replacing it with the wemos board if it is possible to interface the board with psoc.

Thanks.

0 Likes

Hi,

> You mean to say that esp module should response to at commands,

> i.e. return version of at if AT+GMR is typed or return local ip address if AT+CIFSR is typed?

Yes.

> And yes, I have also used ESP8266-01, but it is most likely that the module is burnt

> so I am thinking of replacing it with the wemos board if it is possible to interface the board with psoc.

Unfortunately the chance that your ESP8266-01 has been damaged sounds high.

If you can get OK when you enter AT,

then you could use AT+RESTORE to restore the configuration of the module,

but if the module is damaged, it is no use trying farther with that one.

> Thanks.

You are welcome.

BTW, I hope that at least I have provided one answer about how to use UART of PSoC 4.

And if you are going to start with different module, could you mark an appropriate answer

as Correct Answer and start new discussion with the new module?

I'm afraid that this discussion has already grown rather long.

moto