Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: JshPinState #defines have changed, please update pinStateToString() #929

Closed
MaBecker opened this issue Sep 26, 2016 · 36 comments
Closed
Labels
ESP8266 This is only a problem on ESP8266 devices

Comments

@MaBecker
Copy link
Contributor

Message during boot on ESP board:

 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v87.1711 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
>rll��|�là|��lìb|���ì��r�b�b�ònn�lnn�âìb�p��lrlrlpònà���lbnâ|���b�ònnîl��l`����nnl`���nr���n��l`�pònà��r���âàbnâ|�ì���b�ònnîl`����nnl`���nr���n���lpònà��r���âàìlbnâ|�����b�ònnîl`����nnl`���nr���n��l`��r��n��l`�rl��n��ònn���â�r�nnn�l�b��lì��lì������lll~rlì��llln�â�l�ll�lì��l��nà��nì�n~����llà�bì�llpb��br��ìl`nl�p�ìl`bl`�l��n��n��ânl�|�b��ll`�rl�â�ì��nì�r�òn|ìl�l`��âr�l�þ
ERROR: JshPinState #defines have changed, please update pinStateToString()
 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v87.1711 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
> 

"VERSION": "1v87.1711",
"BUILD_DATE": "Sep 26 2016",
"BUILD_TIME": "20:13:17",
"GIT_COMMIT": "351e779cdcd997753720d31f2a8e41a6ae8b221d",

build options:

RELEASE=1,EMBEDDED=1, USE_NET=1, USE_TELNET=1,USE_GRAPHICS=1, and SDK 2.0

and dump() after reboot does not show any pinMode settings anymore,

@MaBecker
Copy link
Contributor Author

seems to be something complete went wrong with my build and flashed image ......

@MaBecker MaBecker reopened this Oct 18, 2016
@gfwilliams
Copy link
Member

make clean?

@MaBecker
Copy link
Contributor Author

a reboot() lead to a multiple resets and starts without pinMode()


783945> Espruino resetting the esp8266
=undefined
>
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)
load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79
2nd boot version : 1.5
  SPI Speed      : 80MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user2 @ 81000
�â�ì��nì�r�òn|ìl�l`��âr�l�þERROR: JshPinState #defines have changed, please update pinStateToString()

......

 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v87.1711 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
>dump();
=undefined

@MaBecker
Copy link
Contributor Author

a reset(); returns with default pinmode settings

>reset();
=undefined
 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v87.1711 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
>dump();
pinMode(D0, "input_pullup");
pinMode(D4, "input_pullup");
pinMode(D5, "input_pullup");
pinMode(D12, "input_pullup");
pinMode(D13, "input_pullup");
pinMode(D14, "input_pullup");
pinMode(D15, "input_pullup");
=undefined
> 

@MaBecker
Copy link
Contributor Author

what is missing ?

@MaBecker
Copy link
Contributor Author

MaBecker commented Oct 18, 2016

@gfwilliams yes - make clean does not fix this - please a ESP8266 label

@gfwilliams gfwilliams added the ESP8266 This is only a problem on ESP8266 devices label Oct 18, 2016
@MaBecker
Copy link
Contributor Author

@tve any idea ?

@tve
Copy link
Contributor

tve commented Oct 18, 2016

Are you trying to compile master? Have you made changes? I've never seen this but I also haven't updated by fork to master since the 1.87 release. I'd need more info on how to repro.

@MaBecker
Copy link
Contributor Author

MaBecker commented Oct 18, 2016

hmm - just did a new clone of master, flashed, serial connect and power up - same behavior

 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v87.1773 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
>rll��|�là|��lìb|���ì��r�b�b�ònn�lnn�âìb�pì�lrlrlpònà���lbnâ|���b�ònnîl��l`����nnl`���nr���n��l`�pònà��r���âàbnâ|�ì���b�ònnîl`����nnl`���nr���n���lpònà��r���âàìlbnâ|�����b�ònnîl`����nnl`���nr���n��l`��r��n��l`�rl��n��ònn���â�r�nnn�l�b��lì��lì������lll~rlì��llln�â�l�ll�lì��l��nà��nì�n~����llà�bì�llpb��br��ìl`nl�p�ìl`bl`�l��n��n��ânl�|�b��ll`�rl�â�ì��nì�r�òn|ìl�l`��âr�l�þ
ERROR: JshPinState #defines have changed, please update pinStateToString()
 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v87.1773 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
>dump();
=undefined
> 
 >reset();
=undefi
 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v87.1773 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
>dump();
pinMode(D0, "input_pullup", true);
pinMode(D4, "input_pullup", true);
pinMode(D5, "input_pullup", true);
pinMode(D12, "input_pullup", true);
pinMode(D13, "input_pullup", true);
pinMode(D14, "input_pullup", true);
pinMode(D15, "input_pullup", true);
=undefined
> 

@MaBecker
Copy link
Contributor Author

more infos about build:

>process.env
={
  "VERSION": "1v87.1711",
  "BUILD_DATE": "Sep 26 2016",
  "BUILD_TIME": "20:13:17",
  "GIT_COMMIT": "351e779cdcd997753720d31f2a8e41a6ae8b221d",
  "BOARD": "ESP8266_BOARD",
  "CHIP": "ESP8266",
  "CHIP_FAMILY": "ESP8266",
  "FLASH": 0, "RAM": 81920,
  "SERIAL": "5ccf7fc1-120b",
  "CONSOLE": "Serial1",
  "EXPORTS": { "jsvLock": 1075850212, "jsvLockAgainSafe": 1075850268, "jsvUnLock": 1075850644, "jsvSkipName": 1075858932,
    "jsvMathsOp": 1075864108, "jsvMathsOpSkipNames": 1075865796, "jsvNewFromFloat": 1075856892, "jsvNewFromInteger": 1075856792, "jsvNewFromString": 1075856448,
    "jsvNewFromBool": 1075856860, "jsvGetFloat": 1075862004, "jsvGetInteger": 1075858684, "jsvGetBool": 1075862332, "jspeiFindInScopes": 1075876968,
    "jspReplaceWith": 1075876688, "jspeFunctionCall": 1075886960, "jspGetNamedVariable": 1075878776, "jspGetNamedField": 1075879220, "jspGetVarNamedField": 1075879352,
    "jsvNewWithFlags": 1075856188 }
 }
>require("ESP8266").getState()
={
  "sdkVersion": "2.0.0(5a875ba)",
  "cpuFrequency": 160, "freeHeap": 9360, "maxCon": 10,
  "flashMap": "4MB:512/512",
  "flashKB": 4096,
  "flashChip": "0xe0 0x4016"
 }

@MaBecker
Copy link
Contributor Author

MaBecker commented Oct 19, 2016

Question: why is require("ESP8266").reboot() and reset() different in terms of pinMode ?

@MaBecker
Copy link
Contributor Author

flashed 1v89 but still get this error on powerup or reboot ......

>rll��|�là|��lìb|���ì��r�b�b�ònn�lnn�âìb�p��lrlrlpònà���lbnâ|���b�ònnîl��l`����nnl`���nr���n��l`�pònà��r���âàbnâ|�ì���b�ònnîl`����nnl`���nr���n���lpònà��r���âàìlbnâ|�����b�ònnîl`����nnl`���nr���n��l`��r��n��l`�rl��n��ònn���â�r�nnn�l�b��lì��lì������lll~rlì��llln�â�l�ll�lì��l��nà��nì�n~����llà�bì�llpb��br��ìl`nl�p�ìl`bl`�l��n��n��ânl�|�bb�ll`�rl�â�ì��nì�r�òn|ìl�l`��âr�l�þ
ERROR: JshPinState #defines have changed, please update pinStateToString()
 _____                 _
|   __|___ ___ ___ _ _|_|___ ___
|   __|_ -| . |  _| | | |   | . |
|_____|___|  _|_| |___|_|_|_|___|
          |_| http://espruino.com
 1v89.2035 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
> 

>require("ESP8266").getState();
={
  "sdkVersion": "2.0.0(5a875ba)",
  "cpuFrequency": 160, "freeHeap": 8560, "maxCon": 10,
  "flashMap": "4MB:512/512",
  "flashKB": 4096,
  "flashChip": "0xe0 0x4016"
 }
> 

can someone please explain what this is about ?

@clowrey
Copy link

clowrey commented Nov 20, 2016

What version of GCC are you using?

@MaBecker
Copy link
Contributor Author

xtensa-lx106-elf-gcc-4.8.2

@clowrey
Copy link

clowrey commented Nov 20, 2016

When flashing did you fully erase the chip? And does it work with the online compiled binaries that Espruino Travis creates?

@MaBecker
Copy link
Contributor Author

MaBecker commented Nov 20, 2016

no fully erase - using wiflash.sh

same result if flashing with travis build espruino_1v89.7_esp8266.tgz

@clowrey
Copy link

clowrey commented Nov 20, 2016

Does it work with past version of espruino or none? I would try a few from various times. If it works with none of the precomputed binaries then there is some problem with the hardware you're using or method of flashing. I know that PuckJS (nrf52832) is the main new development and there could be incompatibilities in these newer builds with other hardware, which will be fixed in time if that's the case..

@MaBecker
Copy link
Contributor Author

fully erase and flashed with 1v85, 1v86, 1v87 - see the results below

1v85.138 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
-- manual reboot --

rll��|�là|� � lì b|���ì��r�b� b�ònn�lnn�âì b�p��lrlrlpònà�� � l b nâ|�lìl��b�ònnîl��l����nn ��l��nr���n �ll�pònà�� r���âà b nâ|�ì���b�ònnî �l����nn ��l��nr���n ��l�pònà�� r���âàì b nâ|�l�� b�ònnî �l����nn l���nr���n r�l��r��n r�l�rl��n��ònn���â�r�nnn� l�b�bp�lb�l ì��lì����� � lllrl ì��llln�â � l�ll�l ì��l��nà��nì�n����llà�b ì�llpb��br��ìlnl�p�ìlbl�l��n� �n��ânl�|�b� �l l�rldon't use rtc mem data
r�

1v86.185 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
-- manual reboot --

rll��|�là|� � lì b|���ì��r�b� b�ònn�lnn�âì b�pì�lrlrlpònà�� � l b nâ|�lìl��b�ònnîl��l����nn ��l��nr���n �ll�pònà�� r���âà b nâ|�ì���b�ònnî �l����nn ��l��nr���n ��l�pònà�� r���âàì b nâ|�l�� b�ònnî �l����nn l���nr���n r�l��r��n r�l�rl��n��ònn���â�r�nnn� l�b�bp�lb�l ì��lì����� � lllrl ì��llln�â � l�ll�l ì��l��nà��nì�n����llà�b ì�llpb��br��ìlnl�p�ìlbl�l��n� �n��ânl�|�b� �l l�rldon't use rtc mem data
r�

1v87 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
-- manual reboot --

rll��|�là|� � lì b|���ì��r�b� b�ònn�lnn�âì b�p lb�lrlpònà�� � l b nâ|�� � b�ònnîl��l����nn l���nr���n ��l�pònà�� r���âà b nâ|�ì���b�ònnî l����nn l���nr���n � ��lpònà�� r���âàìl b nâ|����� b�ònnî l����nn l���nr���n ��l��r��n ��l�rl��n��ònn���â�r�nnn� l�b��l ì��lì����� � lll~rl ì��llln�â � l�ll�l ì��l��nà��nì�n~����llà�b ì�llpb��br��ìlnl�p�ìlbl�l��n� �n��ânl�|�b� �l l�rl�â�ì��nì�r�òn|ì l� l��âr�l�þERROR: JshPinState #defines have changed, please update pinStateToString()

@clowrey
Copy link

clowrey commented Nov 20, 2016

I think that first block of gibberish is from the esp8266 chip bootloader core that comes out at a different baud rate than the 9600 Espruino uses, I forget if it's 115200 or some other, you can look it up though.

When I have flashed ESP8266 chips in the past I have had similar issues, I think what ended up working for me was using the node MCU flasher tool GUI and then flashing with my espruino code after. I am not entirely sure what the nodeMCU tool does. I used esptool.py for the actual flashing.

But I am not sure that's what's going on with your problem.. I can try flash one of the recent builds later.

@gfwilliams
Copy link
Member

Just search for pinStateToString:

static char *pinStateToString(JshPinState state) {

it's trying to convert the enum defined here: https://github.com/espruino/Espruino/blob/master/src/jshardware.h#L102

into strings - but it's just an array, so if the enums change then it'll get upset. Just copy the enum names into that array in order and you'll be sorted.

@wilberforce
Copy link
Member

@MaBecker

This has been added:
JSHPINSTATE_GPIO_OUT_OPENDRAIN_PULLUP, ///< GPIO pin as open-collector/open-drain output WITH PULLUP

So:

/**
 * Convert a pin state to a string representation.
 * This is used during debugging to log a meaningful value instead of a
 * numeric that would then just have to be decoded.
 */
static char *pinStateToString(JshPinState state) {
  static char *states[] = {
    "UNDEFINED", "GPIO_OUT", "GPIO_OUT_OPENDRAIN",
    "GPIO_IN", "GPIO_IN_PULLUP", "GPIO_IN_PULLDOWN",
    "ADC_IN", "AF_OUT", "AF_OUT_OPENDRAIN",
    "USART_IN", "USART_OUT", "DAC_OUT", "I2C",
  };
  return states[state];
}

Add:

/**
 * Convert a pin state to a string representation.
 * This is used during debugging to log a meaningful value instead of a
 * numeric that would then just have to be decoded.
 */
static char *pinStateToString(JshPinState state) {
  static char *states[] = {
    "UNDEFINED", "GPIO_OUT", "GPIO_OUT_OPENDRAIN",
   "GPIO_OUT_OPENDRAIN_PULLUP",
    "GPIO_IN", "GPIO_IN_PULLUP", "GPIO_IN_PULLDOWN",
    "ADC_IN", "AF_OUT", "AF_OUT_OPENDRAIN",
    "USART_IN", "USART_OUT", "DAC_OUT", "I2C",
  };
  return states[state];
}

@MaBecker
Copy link
Contributor Author

@wilberforce - thanks - I will test and create a pull request in the next days

@MaBecker
Copy link
Contributor Author

MaBecker commented Dec 8, 2016

created pull request #992

@avanc
Copy link

avanc commented Dec 16, 2016

I have the same problem with the precompiled binaries (1v90) from the Espruino website.

 ets Jan  8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 2408, room 16 
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0 
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0 
tail 8
chksum 0xd8
csum 0xd8

2nd boot version : 1.6
  SPI Speed      : 80MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user1 @ 1000

����n�r��n|�l�l`��r�l��ERROR: JshPinState #defines have changed, please update pinStateToString()

@MaBecker
Copy link
Contributor Author

@avanc - check the pull request #992

@avanc
Copy link

avanc commented Dec 16, 2016

@MaBecker : Thanks for the hint. Will the pull request go upstream? Or is it a speciality of the ESP8266?

@avanc
Copy link

avanc commented Dec 16, 2016

I started to compile Espruino on my own (SDK including cross-compiler, compiling espruino) but I got stuck while compiling Espruino:

CC libs/network/esp8266/network_esp8266.o
libs/network/esp8266/network_esp8266.c: In function 'doClose':
libs/network/esp8266/network_esp8266.c:466:5: error: implicit declaration of function 'espconn_abort' [-Werror=implicit-function-declaration]
     espconn_abort(pSocketData->pEspconn);
     ^
libs/network/esp8266/network_esp8266.c: At top level:
cc1: warning: unrecognized command line option "-Wno-float-conversion" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-discarded-qualifiers" [enabled by default]
cc1: some warnings being treated as errors
make: *** [Makefile:1877: libs/network/esp8266/network_esp8266.o] Fehler 1

@MaBecker : Would you mind to share your binaries?

@olliephillips
Copy link

I'm seeing a similar error with Onewire and DS18B20. After only a few cycles board resets and console offers the same error message "ERROR: JshPinState #defines have changed, please update pinStateToString()". Using 1.89 firmware on ESP8266.

@MaBecker
Copy link
Contributor Author

@MaBecker
Copy link
Contributor Author

let me know if this works for you

@alcir
Copy link

alcir commented Dec 18, 2016

esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_freq 80m --flash_mode qio --flash_size 32m 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin

So your espruino_1v89.2053_esp8266 seems to be ok.

I get the same issue as @avanc using espruino_1v90_esp8266 downloaded from espruino site.

@avanc
Copy link

avanc commented Dec 18, 2016

The patched version 1v89.2053 works on my board.

@MaBecker : Thanks, you saved my weekend.

@avanc
Copy link

avanc commented Dec 18, 2016

It seems that I have to dig a little bit deeper what the patch is doing.
I using the following board: http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&item=291850429865

If I'm not wrong I need GPIO5 to activate the relay. However, GPIO5 is always low (I tried digitalWrite(D5,true) ). I Also tried opendrain_pullup. On the other hand, GPIO12 works as expected.

I now saw that something changed with GPIO5 using the patch. So I'm curious what the patch is doing.

@MaBecker
Copy link
Contributor Author

@avanc there is a sanity check for pin function enum to catch ordering changes

the patch just reacts to the change of the enums - thats all

just check yourself 8b0f789

@MaBecker
Copy link
Contributor Author

Hi @tve PR 8b0f789 does not stop 1v90 from rebooting with cause 2

Any hints how analyse such a issue ?

@MaBecker
Copy link
Contributor Author

got it working with a new clone, sdk 1.5.x and 2.0.x for 1v89 and 1v90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ESP8266 This is only a problem on ESP8266 devices
Projects
None yet
Development

No branches or pull requests

8 participants