18F4550 with WLAN_ESP8266 doesn't work

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

Attached a FC V7 file that doesn't work.

Every time I put the Initialise macro into the sheet the LCD doesn't work anymore.

I took the chip configuration from a V6 file that works.
This stops the LCD working every time I put the ESP macro at work...

I've used the standard ESP8266 component and the latest BenJ posted..

Any ideas?
Attachments
Flowcode2.fcfx
(8.18 KiB) Downloaded 319 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by Benj »

Thanks for letting us know.

I am using a very old ESP8266 01 module which is blue.

The last batch of boards I bought are black with ai cloud written on them so I'll see if I can replicate the problem with one of these newer boards. It could be the reply is subtlety different.

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

Thak you BenJ

But the problem occurs while compiling.
You can test this by just try and compile the flowchart.

No need for hardware to check this problem.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by medelec35 »

I have successfully compiled your flowchart using V7.2.1.4:
WLAN version.png
(7.86 KiB) Downloaded 11046 times
WLAN component is the version that was supplied with V7.2.1.4

Code: Select all

Device:        PIC.18F.18F4550
Generated by:  Flowcode v7.2.1.4
Date:          Tuesday, April 18, 2017 16:05:25
Users:         1
Registered to: Martin
Licence key:   BA48R5
http://www.matrixtsl.com
Launching the compiler...
C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe  --chip=18F4550 "Flowcode2 (3).c" --MSGDISABLE=359,1273,1388
Microchip MPLAB XC8 C Compiler (PRO Mode) V1.41
Build date: Jan 24 2017
Part Support Version: 1.41
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration

Employing 18F4550 errata work-arounds:
 * Corrupted fast interrupt shadow registers
.

C:\Program Files (x86)\Flowcode 7\CAL\internals.c: 71: (1090) variable "_FCI_TMP_STR" is not used (warning)
C:\Program Files (x86)\Flowcode 7\CAL\internals.c: 72: (1090) variable "_FCI_TMP_INT" is not used (warning)
C:\Program Files (x86)\Flowcode 7\CAL\PIC\PIC_CAL_UART.c: 482: (1090) variable "FC_CAL_UART_Receive_1@dummy" is not used (warning)

Memory Summary:
    Program space        used   8F1h (  2289) of  8000h bytes   (  7.0%)
    Data space           used   289h (   649) of   800h bytes   ( 31.7%)
    Configuration bits   used     7h (     7) of     7h words   (100.0%)
    EEPROM space         used     0h (     0) of   100h bytes   (  0.0%)
    ID Location space    used     0h (     0) of     8h bytes   (  0.0%)
    Data stack space     used     0h (     0) of   568h bytes   (  0.0%)


Launching the linker/assembler...
C:\Program Files (x86)\Flowcode 7\tools\DoNothing\DoNothing.exe  


FINISHED
I am using compiler at work and its the pro version which could make a difference?

Martin
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by Benj »

Hmm it's compiling ok for me too using the free XC8.
Microchip MPLAB XC8 C Compiler (Free Mode) V1.41
Build date: Jan 24 2017
Part Support Version: 1.41
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration

Employing 18F4550 errata work-arounds:
* Corrupted fast interrupt shadow registers
. . . .


Memory Summary:
Program space used CA7h ( 3239) of 8000h bytes ( 9.9%)
Data space used 2AEh ( 686) of 800h bytes ( 33.5%)
Configuration bits used 7h ( 7) of 7h words (100.0%)
EEPROM space used 0h ( 0) of 100h bytes ( 0.0%)
ID Location space used 0h ( 0) of 8h bytes ( 0.0%)
Data stack space used 0h ( 0) of 50Ch bytes ( 0.0%)


You have compiled in FREE mode.
Using Omniscient Code Generation that is available in PRO mode,
you could have produced up to 60% smaller and 400% faster code.
See http://www.microchip.com/MPLABXCcompilers for more information.


Launching the linker/assembler...
F:\Flowcode 7\tools\DoNothing\DoNothing.exe


FINISHED
Having a quick hardware test now to make sure both blue and black modules work ok.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by Benj »

Right just tried the old blue board, the new black board and also the ESP-12S module and all initialised OK (returned the value 1) and returned the firmware ID within a few seconds.

Blue ESP8266 - FW "00150900"
Black ESP8266 - FW "SDK version:1.1."
ESP-12S - FW "AT version:1.1.0"

Note that the firmware version is limited to the size of LCD i'm using.

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

I'm sorry, my mistake..

It appears when there is only the LCD and the ESP component in the flowchart.

For testing purposes there doesn't need to be an ESP attached.
The error occurs on the LCD only.

So only this flowchart with an LCD shows the problem (the LCD doesn't work when the ESP component is initialised)..

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

Any news on this one??

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by Benj »

Hello,
But the problem occurs while compiling.
Both me and Matrin have tried to replicate the compilation error and it is compiling ok for us, are you still getting a compile error, if so then can you post the details.

If it's just that the LCD stops working after you have initialised the ESP module then maybe there is a timeout happening. How long have you waited to see if the initialise eventually ends.

Something like this should help.

LCD Init
LCD Print "Init"
ESP8266 Init
LCD Pring " Done"

Also what version of the ESP module are you using? colour? firmware version?

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

I have made a flowchart that does following.

1- start the LCD
2- print "start"
3- initialise the WLAN..
4- wait the response.
5- wait 200ms
6- check the response and print the result.

The LCD shows nothing from start.

If I remove the "initialise" macro, the LCD works.
Something is wrong, just can't get what...

I use the same settings that I use in Flowcode 6..

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

I've made the same program in FC V6 and V7.

When I look into the generated C-code I find differences in the generated code.
In the UART stuff I find these differences:

/*========================================================================*\
Use :cal_uart1
:Variabele declaratie
:Macro functie declaraties.
\*========================================================================*/
V7 = #define MX_UART_CTS_PORT_1 portb
V6 = #define MX_UART_CTS_PORT_1 portc

V7 = #define MX_UART_RTS_TRIS_1 trisb
V6 = #define MX_UART_RTS_TRIS_1 trisc

V7 = #define MX_UART_CTS_TRIS_1 trisb
V6 = #define MX_UART_CTS_TRIS_1 trisc

V7 = #define MX_UART_CTS_PIN_1 (3)
V6 = #define MX_UART_CTS_PIN_1 (5)


Maybe this is not the problem, but the fact is that the LCD is connected to the B-port, and the code in the Flowcode 7 some references go to port B makes me wonder.
Could this be something?

Can I edit the V7 C-code in this manner that I can test it? How can I flash the changed C-code to the chip?

I really hope this is the problem, and can be solved.
I've waisted already too much time searching for the solution.. :cry:

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by Benj »

Hello,

Try the component debugger window and expose component tree tickbox, this will let you go down through the properties of nested components. The one you're looking for is the CAL UART. Check that the flow control property is set to off.
CompProps.jpg
CompProps.jpg (60.8 KiB) Viewed 16392 times
A while ago it was being set to on behind the scenes which was causing problems but this should have been fixed a long time ago. Unless for some reason it's come back. If it's already set to off then you don't have to worry about it but it sounds like something is messing with the LCD connections.

After you print start to the LCD try adding a delay so you can read the message before the ESP initialise macro is called.

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

Benj wrote:Hello,

Try the component debugger window and expose component tree tickbox, this will let you go down through the properties of nested components. The one you're looking for is the CAL UART. Check that the flow control property is set to off.
CompProps.jpg
A while ago it was being set to on behind the scenes which was causing problems but this should have been fixed a long time ago. Unless for some reason it's come back. If it's already set to off then you don't have to worry about it but it sounds like something is messing with the LCD connections.

After you print start to the LCD try adding a delay so you can read the message before the ESP initialise macro is called.
Tried it.
Flowcontrol was OFF.

Print a text onto the LCD
Added a delay of 5 sec before initialise the WLAN.. component.
Added another delay after intialise and then tried to print another thing..

After sending this to the PIC, same problem.
Just some white blocks on the LCD.
No readable text.

After removing the WLAN initialisation from the Flowchart. The LCD works..

Same problem..

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by Benj »

Hello,

Have you tried a 1 second flasher test, your clock speed and config settings look a bit off to me. Do you have a later version of your project you can post?

With your config settings the clock speed should probably be changed to 48000000 to ensure the ESP baud rate is correct.

How fixed are your LCD pins? Have you tried the display on other pins to see if this makes any difference? I don't see why but it's worth trying if it's easy to move the pins.

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

Benj wrote:Hello,

Have you tried a 1 second flasher test, your clock speed and config settings look a bit off to me. Do you have a later version of your project you can post?

With your config settings the clock speed should probably be changed to 48000000 to ensure the ESP baud rate is correct.

How fixed are your LCD pins? Have you tried the display on other pins to see if this makes any difference? I don't see why but it's worth trying if it's easy to move the pins.
I really don't get it anymore.

I used to put a 1 sec timer led in every project with the 18F4550 and everytime it worked.
Now when I load an old project, the led flasher is much too slow..

But all projects are too slow now.
I have a printscreen of working settings from before, but they don't seem to work anymore..
Maybe something with my hardware? :?

Shit, I have to find out...

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by Benj »

Hmm, Sounds like something has changed.

Do you have an old known working hex file you can try to confirm if it's the hardware that has changed or the software.

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

Benj wrote:Hmm, Sounds like something has changed.

Do you have an old known working hex file you can try to confirm if it's the hardware that has changed or the software.
The RC/XTAL switch on my Eblock EB006 board was faulty again.

Next days I will try and start the project again..

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

Started with a clean sheet.

1 Made a 1 sec LED flasher (works)
2 Added 4 *20 LCD (works)
3 Added the WLAN 8266 component (works)

4 Initialised the WLAN component (LCD doesn't work, 1 sec LED flasher works)
5 Added delay's before and after the initialise macro (LCD doesn't work, 1 sec LED flasher works)
6 Removed the initialise macro (LCD and 1 sec flasher works)..

Conclusion, there is something wrong with the WLAN initialise component???

The fact that with initialisation, in the C-code (in the UART part) there are references tot the B-port: is that normal??
See previous post...

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

Bump.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by LeighM »

Could you post your latest Flowcode project?
In particular, does the LCD not work even if the WLAN Initialise macro runs after the display text macro?
Also, with your latest Flowchart, have you tried Ben's suggestion above about checking the UART CAL properties via the full tree expose in the Component Debugger?

edit: Also, are you using the latest components?
http://www.matrixtsl.com/mmforums/viewt ... 63&t=18760

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

LeighM wrote:Could you post your latest Flowcode project?
In particular, does the LCD not work even if the WLAN Initialise macro runs after the display text macro?
Also, with your latest Flowchart, have you tried Ben's suggestion above about checking the UART CAL properties via the full tree expose in the Component Debugger?

edit: Also, are you using the latest components?
http://www.matrixtsl.com/mmforums/viewt ... 63&t=18760
Using the lastest files.

Flowcontrol is OFF:
FC.jpg
FC.jpg (128.68 KiB) Viewed 15725 times
Here is the file:
ESP8266 met 1 seconde timer.fcfx
(11.02 KiB) Downloaded 181 times
No avail..

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by Benj »

Hello,

As an outside the box idea how are you powering the micro and ESP module? The ESP module can be power hungry and so maybe the powering is causing the micro to brown out and therefore not run correctly.

When you add the initialise does the screen work the first time but then not afterwards? Or is it not working straight away.

I see your brown out voltage is set to 2V in the config settings but at 2V the fastest you can drive the micro is 2MHz. For 48MHz operation you need at least 4.2V.

Also your config options and clock settings maybe don't look right. What crystal value are you using? If as specified it's the 19.6608 MHz crystal then you need at least 3.5V.

The 1 second flasher test will help you to get these settings right and also help to confirm when your device is running.

https://www.matrixtsl.com/wikiv7/index. ... ED_flasher

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

Benj wrote:Hello,

As an outside the box idea how are you powering the micro and ESP module? The ESP module can be power hunrgy and so maybe the powering is causing the micro to brown out and therefore not run correctly.

When you add the initialise does the screen work the first time but then not afterwards? Or is it not working straight away.

I see your brown out voltage is set to 2V in the config settings but at 2V the fastest you can drive the micro is 2MHz. For 48MHz operation you need at least 4.2V.

Also your config options and clock settings don't look right. The config settings seem setup for 48MHz but the project clock speed is 19.6608, this means the baud rates to the ESP module will be wrong.

The 1 second flasher test will help you to get these settings right and also help to confirm when your device is running.

https://www.matrixtsl.com/wikiv7/index. ... ED_flasher
I disconnected the device (the ESP).
Even then the problem stays from the start of the program.

There isn't a power issue because the same board works:
- when the ESP is connected but not initialised
- With FC 6 programs..

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by LeighM »

So with the attached program you do not get anything on the display but the LED flashes?
What happens if you remove the TMR1 initialization?

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: 18F4550 with WLAN_ESP8266 doesn't work

Post by MJU »

LeighM wrote:So with the attached program you do not get anything on the display but the LED flashes?
What happens if you remove the TMR1 initialization?
Tried it just now...
Back to #1..

Just the way I started this topic..

Post Reply