0

I 'm working on esp8266 module these days. The firmware on this module is nodemcu 0.9.6 and its language is lua. I use mqtt protocol for my project and it works well.But TLS is necessary. I don't know how to set tls on this firmware. I 've searched but documents about TLS on nodemcu website is not enough for me.

I know that I should use this instruction at connection time to broker:

m:connect(BROKER, 8883, 1 , function ( connection ) ... end ) 

and to put the CA file on module i should use something like this:
enter image description here

that 's what i read from nodemcu website --> https://nodemcu.readthedocs.io/en/master/en/modules/net/#netcertverify

but the problem is when i use this on my code the module doesn't understand it and gives error at upload time and runtime.
is this problem because of the version of my firmware? Upgrading will make it? Or I am just doing something wrong on my code? I haven't seen sample code about putting CA file on module in other project so I guess my work is wrong.
if you have worked on TLS ( on nodemcu firmware ) I would be happy by your helps.

mpromonet
  • 11,326
  • 43
  • 62
  • 91
Rezvan
  • 11
  • 3

2 Answers2

2
  • Build a recent firmware with SSL/TLS enabled.
  • Flash the binary to upgrade. Make sure all flashing parameters are exactly as documented and include the init data binary.

The rest of your code seems fine.

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
  • building and flashing the firmware was my next issue :) Now I 've spent near one week on flashing firmware. I read as much document as i found! – Rezvan Sep 18 '16 at 16:50
  • but problem is'nt solved. My friend also has asked about this: http://stackoverflow.com/questions/39512319/nodemcu-custom-firmware-build-problems I don't have enough time, so I would rather change the firmware to work with arduino – Rezvan Sep 18 '16 at 17:02
  • "but problem is'nt solved." - which problem? The flashing problem? Yours or the one of your friend? Please be more specific. – Marcel Stör Sep 18 '16 at 20:20
  • yes. me and my friend are working with each other on the same project. our problem is upgrading nodemcu firmware. – Rezvan Sep 19 '16 at 11:47
0

Take a look at this question and read through comments of the answer.

You may have to get esp_init_data_default.bin from latest sdk.

I used esptool.

esptool.py --port <PORT> write_flash -fm dio -fs 32m 0x00000 <BIN_PATH_AND_FILENAME> 0x3fc000 <PATH\>esp_init_data_default.bin

Please do upvote this post if you find it is useful. Thumbs up for @MarcelStör.

Community
  • 1
  • 1
Lakmal Premaratne
  • 1,159
  • 7
  • 18
  • 34