CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Testing my thinking

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MarkchchPIC



Joined: 14 Jan 2015
Posts: 18
Location: Christchurch New Zealand

View user's profile Send private message

Testing my thinking
PostPosted: Wed Sep 13, 2017 10:46 pm     Reply with quote

Hi All,

I wish to test my thinking on a project before I hit the computer to create code.
I have an 18F46k20 running at 3.3v and I wish to experiment with an ESP01 module which also runs at 3.3v.

My question relates to using the UART of the PIC to talk to the ESP01 with AT Commands.
If I understand correctly I would cross connect the two devices i.e PIC TX to ESP RX and PIC RX to ESP TX. Then using a baud rate of 115200 I should be able to talk to the ESP01 module sending strings from the PIC.

Have I understood correctly?

Cheers

Mark
Ttelmah



Joined: 11 Mar 2010
Posts: 19217

View user's profile Send private message

PostPosted: Thu Sep 14, 2017 1:21 am     Reply with quote

Yes.

Several comments:

1) Make sure the module you get has the later V2 firmware. It is possible to upgrade the module, but is a complexity you don't want to get involved in at this point.
2) The CH_PD pin will also need to be taken to 3.3v, so there are five connections needed. GND, 3.3v power, TX, RX, and this pin. Some boards have a jumper on the board to pull this pin to Vcc. If so you can use this.
3) RST should be pulled high on the module, but adding a 10KR resistor to pull this high is safer.
4) Old comment, make sure you add a nice capacitor on your supply where it connects to the module. It can tend to inject RF back into the supply rail otherwise...
5) Be careful if you want to use GPIO0 or 2. GPIO0 in particular must float at boot for normal operation. Pulling this low can trigger the firmware bootloader.

They are a nice module, and easy to use. Take your time and make sure you are understanding what you intend to send before talking to it. You don't want to accidentally re-configure it to the wrong baud etc..
Remember carriage return.

printf("AT\r");

is what is needed to get the initial "OK" response.

Also give is some time to wake up before starting to talk to it. The ESP takes a minimum of 0.2 seconds to start.
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Thu Sep 14, 2017 1:55 pm     Reply with quote

Hi,

Just out of curiosity, what do you plan to do with the ESP01 module? I ask because I started out a few years ago using the PIC with the ESP series via the UART, but then realized that I could do everything with just the ESP alone (it has a built in micro!). These modules are easy to work with using the Arduino IDE and a simple USB-to-serial programming cable. I designed a suite of IoT wireless sensors this way, and they've been working flawlessly for 2 years! As much as I love PIC's and CCS 'C', it just wasn't needed for my applications!
_________________
John

If it's worth doing, it's worth doing in real hardware!
MarkchchPIC



Joined: 14 Jan 2015
Posts: 18
Location: Christchurch New Zealand

View user's profile Send private message

Thanks
PostPosted: Thu Sep 14, 2017 2:17 pm     Reply with quote

Thanks to you both.

Ttelmah, great advice to get me started.

ezflyr, I realise I could do more directly using the modules like the wemosD1.
I have a lot of other code and hardware already setup for PIC and would like to use the ESP01 to get me on the net.

Cheers

Mark
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group