Hi, thanks again...
Mobile ESP will use in open terrain for handball...2 parts of 20x20 meters totally 40x20 m, with receiver + PC at center of side line...normal range for wifi, I don't know for bluetooth...I select that ESP for small size and easy programming..
I think that missing some details to link 2 ESP...of course if there is no problem with components..
PIC18F25K22 UART ERROR
-
- Posts: 123
- http://meble-kuchenne.info.pl
- Joined: Tue Dec 13, 2022 9:04 pm
- Has thanked: 32 times
- Been thanked: 2 times
-
- Posts: 123
- Joined: Tue Dec 13, 2022 9:04 pm
- Has thanked: 32 times
- Been thanked: 2 times
Re: PIC18F25K22 UART ERROR
Hi
below are the 2 codes after some changes...It seems that there is no link between 2 ESP..I think that something is missing , or it is wrong mainly at code2 (PIC18F25K22), in section after comment (get data from ESP2)..I'll check again hardware for pic or ESP damage , but I don't think so.
below are the 2 codes after some changes...It seems that there is no link between 2 ESP..I think that something is missing , or it is wrong mainly at code2 (PIC18F25K22), in section after comment (get data from ESP2)..I'll check again hardware for pic or ESP damage , but I don't think so.
- Attachments
-
- ESP8266_STA_PIC18F46K22_SENSORS.fcfx
- (30.93 KiB) Downloaded 697 times
-
- ESP8266_AP_PIC18F25K22.fcfx
- (22.6 KiB) Downloaded 642 times
-
- Valued Contributor
- Posts: 1607
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 357 times
- Been thanked: 565 times
Re: PIC18F25K22 UART ERROR
Hi
Sorry to be brief, a bit busy just now.
Looking at "sensors" you won't need that UART as the ESP8266 component will handle comms.
The force sensor is only read once, it isn't in the loop. That may be all you require ?
I see you end the String creation with "\n" however you should use "\r\n"
As mentioned, I haven't used the ESP for a while but from what I see in your chart if you made the changes above it should send out your String with maybe just a few tweaks needed.
The AP chart needs a bit of work though and I'll have a look at that once I refamiliarise myself with the ESP.
Regards
Sorry to be brief, a bit busy just now.
Looking at "sensors" you won't need that UART as the ESP8266 component will handle comms.
The force sensor is only read once, it isn't in the loop. That may be all you require ?
I see you end the String creation with "\n" however you should use "\r\n"
As mentioned, I haven't used the ESP for a while but from what I see in your chart if you made the changes above it should send out your String with maybe just a few tweaks needed.
The AP chart needs a bit of work though and I'll have a look at that once I refamiliarise myself with the ESP.
Regards
-
- Valued Contributor
- Posts: 1607
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 357 times
- Been thanked: 565 times
Re: PIC18F25K22 UART ERROR
Hi
I had a quick look at the ESP8266 and things came back to mind.
First is that FC components may or may not work correctly (which isn't anybody's fault) depending on ESP firmware. Matrix spend time making a component, then the manufacturer of the component goes and changes the firmware.... so first thing I will do when I get a chance to play is confirm my modules all work, or download compatible firmware. Of course I could use the UART to send "AT" instead and capture replies, but that is probably a lot more work. I'm guessing though that recent ESP8266 modules will work fine. Mine are old enough to have dust on the dust and firmware version in Roman numerals...
When we send the string we will be using TCP/UDP so instead of SendString we will probably instead use ClientSendRequest as this component automatically calculates string length etc.
I'll look more on the AP side of things when I get a chance.
Regards
I had a quick look at the ESP8266 and things came back to mind.
First is that FC components may or may not work correctly (which isn't anybody's fault) depending on ESP firmware. Matrix spend time making a component, then the manufacturer of the component goes and changes the firmware.... so first thing I will do when I get a chance to play is confirm my modules all work, or download compatible firmware. Of course I could use the UART to send "AT" instead and capture replies, but that is probably a lot more work. I'm guessing though that recent ESP8266 modules will work fine. Mine are old enough to have dust on the dust and firmware version in Roman numerals...

When we send the string we will be using TCP/UDP so instead of SendString we will probably instead use ClientSendRequest as this component automatically calculates string length etc.
I'll look more on the AP side of things when I get a chance.
Regards
-
- Valued Contributor
- Posts: 1607
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 357 times
- Been thanked: 565 times
Re: PIC18F25K22 UART ERROR
Hi
I can only find one of my modules, the others are kicking around somewhere so I've ordered up a couple more as I will probably push them into service with something. They should arrive in a couple of days.
Just a thought, have you actually range tested two modules? You are having one as an AP with the other connecting to it, but have you done any tests to see how far apart you can stretch them?
You are looking to cover a minimum of 20m (40m court / 2) which might be a bit of a stretch for these modules as they don't have great antennas. Recently I had a couple of ESP32's that would barely cover 8m LoS to a home broadband router (phones etc could connect at far, far greater distances).
Regards
I can only find one of my modules, the others are kicking around somewhere so I've ordered up a couple more as I will probably push them into service with something. They should arrive in a couple of days.
Just a thought, have you actually range tested two modules? You are having one as an AP with the other connecting to it, but have you done any tests to see how far apart you can stretch them?
You are looking to cover a minimum of 20m (40m court / 2) which might be a bit of a stretch for these modules as they don't have great antennas. Recently I had a couple of ESP32's that would barely cover 8m LoS to a home broadband router (phones etc could connect at far, far greater distances).
Regards
-
- Posts: 123
- Joined: Tue Dec 13, 2022 9:04 pm
- Has thanked: 32 times
- Been thanked: 2 times
Re: PIC18F25K22 UART ERROR
Hi, many thanks anyway..
according to many tests, range for ESP8266-12E it was 60 m. minimum in open air...I think that in range of 20 m. there is no problem...in any case range can extended ..I made some tests with ardunino IDE to check hardware...works ok...maybe some components not work properly...codes for ESP at arduino library can convert to FC , or we can get some info from that, on how to receive data from ESP..examples from wiki are only for connection to web page, not for send and receive data array...
according to many tests, range for ESP8266-12E it was 60 m. minimum in open air...I think that in range of 20 m. there is no problem...in any case range can extended ..I made some tests with ardunino IDE to check hardware...works ok...maybe some components not work properly...codes for ESP at arduino library can convert to FC , or we can get some info from that, on how to receive data from ESP..examples from wiki are only for connection to web page, not for send and receive data array...
-
- Valued Contributor
- Posts: 1607
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 357 times
- Been thanked: 565 times
Re: PIC18F25K22 UART ERROR
Hi
New modules due tomorrow (Sun) but earlier today I found a couple of older ones.
The first had been pre-programmed to do something so as it was still happy to do it, I left it alone
The second, when connected @115200 and boots, it churns out a lot of info before you get a "Ready". All good so I thought.
I typed in "AT" and received an echo, which is still looking good, but when hitting enter I didn't get any "OK", I got hee-haw (Scottish expression). You need to end each command with CTRL+M CTRL+J or set up your terminal program to do so. Terminal (by Brady) can do this (CR LF) but I'd disabled it for something. Won't tell you how long I spent before realising..........
Once I could interrogate the module using "AT" commands and was happy enough that it was alive and well I connected it up to a PIC running some code. I was using the ESP8266 component. The PIC has some buttons, a display and the ESP8266 connected to it. Pushing buttons sends pre assigned commands.
Pushing the first button initialises the module then displays the response, with the rest doing things like obtaining FW version, connecting to SSID etc. This enables me to establish that each command is successful before moving on.
Not a lot of luck with that. I was again getting hee-haw from the module. I had preassigned the initial value of my Return variable used in the initialisation macro to 128 and as this was being returned after what I assume is a time-out, I guess the macro didn't modify it to 0/1/255 / whatever.
Connecting the PIC directly to Terminal (instead of module) and pressing the first button showed junk characters being received. Total nonsense. It transpires that if I then set my terminal to 128000 baud I can receive legible commands from the PIC using the ESP component, but of course the ESP is expecting a baud of 115200 so isn't responding to anything the PIC sends.
I'm not aware of 128000 being a default speed for these modules, but I could be wrong and I'll look into it later.
I can either just send AT to the module using the UART or I could modify the ESP to run at 128000, but that is for another day. I'll see what the new modules run at once I get them.
Regards
EDIT...
Looking at the ESP8266 documentation it doesn't look like it can support 128000 baud.. UART looking favourite.....
New modules due tomorrow (Sun) but earlier today I found a couple of older ones.
The first had been pre-programmed to do something so as it was still happy to do it, I left it alone

The second, when connected @115200 and boots, it churns out a lot of info before you get a "Ready". All good so I thought.
I typed in "AT" and received an echo, which is still looking good, but when hitting enter I didn't get any "OK", I got hee-haw (Scottish expression). You need to end each command with CTRL+M CTRL+J or set up your terminal program to do so. Terminal (by Brady) can do this (CR LF) but I'd disabled it for something. Won't tell you how long I spent before realising..........
Once I could interrogate the module using "AT" commands and was happy enough that it was alive and well I connected it up to a PIC running some code. I was using the ESP8266 component. The PIC has some buttons, a display and the ESP8266 connected to it. Pushing buttons sends pre assigned commands.
Pushing the first button initialises the module then displays the response, with the rest doing things like obtaining FW version, connecting to SSID etc. This enables me to establish that each command is successful before moving on.
Not a lot of luck with that. I was again getting hee-haw from the module. I had preassigned the initial value of my Return variable used in the initialisation macro to 128 and as this was being returned after what I assume is a time-out, I guess the macro didn't modify it to 0/1/255 / whatever.
Connecting the PIC directly to Terminal (instead of module) and pressing the first button showed junk characters being received. Total nonsense. It transpires that if I then set my terminal to 128000 baud I can receive legible commands from the PIC using the ESP component, but of course the ESP is expecting a baud of 115200 so isn't responding to anything the PIC sends.
I'm not aware of 128000 being a default speed for these modules, but I could be wrong and I'll look into it later.
I can either just send AT to the module using the UART or I could modify the ESP to run at 128000, but that is for another day. I'll see what the new modules run at once I get them.
Regards
EDIT...
Looking at the ESP8266 documentation it doesn't look like it can support 128000 baud.. UART looking favourite.....
-
- Valued Contributor
- Posts: 1607
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 357 times
- Been thanked: 565 times
Re: PIC18F25K22 UART ERROR
Hi
Thinking it strange that FC would send at 128000 instead of 115200, which isn't exactly a "typo" I had a closer look.
I'm using my BL0080 rather than my EB006 which I'm more familiar with, and a major difference is clock. If using external the BL0080 has an 8MHz whereas the EB006 use 19.xxxMHz.
Setting my PIC for internal clock + PLL had the accuracy of the baud restored.
Now for some tests.
I set up with the PIC talking directly to Terminal @115200 and all good. I could see what was coming out.
Connecting the PIC to the module I monitored the PIC Tx (module Rx) and again the correct commands (initialise) were being received at the pin, but my test program didn't detect any response.
Monitoring the module Tx (PIC Rx) I then resent the initialisation command and the module replied by echoing the "AT" command followed by an "OK"
My program still didn't acknowledge receipt so I guess it is looking for a different response to that of "OK".
I tried connecting to SSID, having preset the PIC with my details, and this command was successful. The correct Return value was received from the component (1) and looking at my router logs the ESP is connected.
So at present it looks like the ESP8266 Initialise command is accepted, but FC is looking for a different response to that provided, possibly due to Espressif changing firmware. If I remember correctly this is the problem I had years ago (circa 2015) and Kersing (forum VC) kindly provided a modified component.
I'm unsure if any other command is similarly affected but no doubt I'll find out as I test further.
Regards
Thinking it strange that FC would send at 128000 instead of 115200, which isn't exactly a "typo" I had a closer look.
I'm using my BL0080 rather than my EB006 which I'm more familiar with, and a major difference is clock. If using external the BL0080 has an 8MHz whereas the EB006 use 19.xxxMHz.
Setting my PIC for internal clock + PLL had the accuracy of the baud restored.
Now for some tests.
I set up with the PIC talking directly to Terminal @115200 and all good. I could see what was coming out.
Connecting the PIC to the module I monitored the PIC Tx (module Rx) and again the correct commands (initialise) were being received at the pin, but my test program didn't detect any response.
Monitoring the module Tx (PIC Rx) I then resent the initialisation command and the module replied by echoing the "AT" command followed by an "OK"
My program still didn't acknowledge receipt so I guess it is looking for a different response to that of "OK".
I tried connecting to SSID, having preset the PIC with my details, and this command was successful. The correct Return value was received from the component (1) and looking at my router logs the ESP is connected.
So at present it looks like the ESP8266 Initialise command is accepted, but FC is looking for a different response to that provided, possibly due to Espressif changing firmware. If I remember correctly this is the problem I had years ago (circa 2015) and Kersing (forum VC) kindly provided a modified component.
I'm unsure if any other command is similarly affected but no doubt I'll find out as I test further.
Regards
-
- Posts: 123
- Joined: Tue Dec 13, 2022 9:04 pm
- Has thanked: 32 times
- Been thanked: 2 times
Re: PIC18F25K22 UART ERROR
Hi, and many thanks for your time.
I change client PIC (STA) to test connection between 2 ESP, with no results. At server side (PIC18F25K22+serial/USB module ), I can send data to Excel with UART1::SendFloat() , but I can't collect data from client .in this case I get 0,0,0 . I think that maybe there is a problem with ESP firmware and FC component.maybe there is a need of both modification .I did't expected those problems, ARDUINO IDE can program directly ESP mcu , but it's not easy to change hardware now. In wifi networks of pc router there is SSID that I set in server code (AP mode)..so communication of server PIC (AP) with ESP (RX,TX) is ok..only wireless connect between 2 ESP is missing..
I change client PIC (STA) to test connection between 2 ESP, with no results. At server side (PIC18F25K22+serial/USB module ), I can send data to Excel with UART1::SendFloat() , but I can't collect data from client .in this case I get 0,0,0 . I think that maybe there is a problem with ESP firmware and FC component.maybe there is a need of both modification .I did't expected those problems, ARDUINO IDE can program directly ESP mcu , but it's not easy to change hardware now. In wifi networks of pc router there is SSID that I set in server code (AP mode)..so communication of server PIC (AP) with ESP (RX,TX) is ok..only wireless connect between 2 ESP is missing..
-
- Valued Contributor
- Posts: 1607
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 357 times
- Been thanked: 565 times
Re: PIC18F25K22 UART ERROR
Hi
New ESP8266's arrived and all happy with AT @115200.
I'll probably just use AT commands issued from PC's to test with first, to try and figure things out.
Busy for the next couple of days though.
Regards
New ESP8266's arrived and all happy with AT @115200.
I'll probably just use AT commands issued from PC's to test with first, to try and figure things out.
Busy for the next couple of days though.
Regards