Problem with module ILI9341

Posted on
  • Good day, everyone! I have a problem with module ILI9341. I'm plugging it in on esp12F. After loading and cleaning the screen appears, after which the esp is rebooted and so on. Please help if anyone knows what the problem is.

    var ESP8266 = require("ESP8266"),
         wifi = require("Wifi");
    function onInit() {
      wifi.stopAP();
       wifi.connect("INGRIFABSR", {password: "B73vFeX6se2"}, function(err) { // 192.168.99.61
           if(err)console.log(err);else {
            print("connected! "+wifi.getIP().ip);
    var SPI1 = new SPI();
        SPI1.setup({ sck:D14, miso:D12, mosi:D13 ,baud: 1000000});
    var g = require("ILI9341").connect(SPI1, D5, D15, D4, function() {
      g.clear();
      g.drawString("Hello",50,50);
    //  g.setFontVector(20);
    //  g.setColor(1,0.5,1);
    //  g.drawString("Espruino",0,10);
    });
         }
       });
    }
     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v00 (c) 2018 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:1024/1024, manuf 0xef chip 0x4016
    >
    >save()
    =undefined
    Compacting Flash...
    Calculating Size...
    Writing..
    ComRunning onInit()...
    connected! 192.168.99.106
    >
     ets Jan  8 2013,rst cause:2, boot mode:(3,5)
    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      : 40MHz
      SPI Mode       : DIO
      SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
    jump to run user1 @ 1000
    
  • Please check SPI pins on ESP8266 page

    http://www.espruino.com/EspruinoESP8266

  • The hardware SPI uses the pins shown in the board layout (CLK:D14, MISO:D12, MOSI:D13, CS:D15).
    reset D5
    cs D4
    connected everything correctly

  • The hardware SPI uses the pins shown in the board layout (CLK:D14, MISO:D12, MOSI:D13, CS:D15).

    reset D5
    cs D4
    connected everything correctly

  • var SPI1 = new SPI(); // create a new software SPI

    ESP8266 has one hardware SPI named SPI1.

    SPI1.setup(......)

  • Fri 2018.10.26

    Hello @user79559,

    re: 'connected everything correctly'

    I made this mistake the first time using SPI. Worth taking yet another look.

    Under 'Data Transmission'

    https://en.wikipedia.org/wiki/Serial_Per­ipheral_Interface_Bus

    Unlike Tx-Rx wiring SPI is MOSI-MOSI

    The Espruino device is the master so MOSI is an output to the input pin of the slave device

  • Connected TFT, does screen cleaning, then outputs half of the word " hi " and does reboot :)

  • Connected TFT, does screen cleaning, then outputs half of the word " hi " does reboot :)

  • ...you may be short on power... What is your power supply setup?

  • I understand the problem. When you output a long word, it fails. And when you perform on a short command, there is no failure. Use this method is unrealistic. Maybe in the future it will make the library better

  • When you output a long word, it fails. And when you perform on a short command, there is no failure.

    @user79559, could you please elaborate on that a bit more? (cannot see anywhere in your code something that displays "Hi...*).

    The restart may have different causes:

    • running out of heap space
    • running out of time (js work has to complete in the breaks between ESP8266 has to tend Wifi business)
    • running out of power (brown out... if ESP8266 is not solidly powered / has not enough decoupling capacitance across GND and VCC, or power supply is too weak - too many other things are on the 3.3V rail together with ESP8266 - ESP8266 Wifi operation takes it down...)
  • @MaBe, if you want to use the HW SPI, do you still need to create one with new SPI()? Can you not just use the SPI1? SPI1 - all uppercase - is defined in ESP8266 (just checked0). var SPI1 = new SPI() may mess with that. If you want to create the SW SPI, I'd - by my gut to stay way for sure from trouble / interference - use spi = new SPI(); to not mess with SPI1...

    >SPI // <--- entered in console
    =function () { [native code] }
    >SPI1 // <---
    =SPI1
    >SPI1.setup() // <---
    =undefined
    >var s = SPI1; // <---
    =SPI1
    >SPI1 = new SPI(); // <---
    =SPI: {  }
    >SPI1 === s // <---
    =false
    >SPI1 // <---
    =SPI: {  }
    >
    

    Lines 5 and 14 and 11 show that you get new objects... and loose the HW SPI, I guess... do you? May be it just looks on the JS level that way, but not under the hood where it is created before JS takes place.

  • ...found this ESP8266 reset cause list - http://iot-bits.com/esp8266/esp8266-rese­t-causes-rst-cause/

    (right bow I experience 4... code stuck or failing....)

  • UPS, yes it is just SPI

  • or

    • unaligned memory access
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Problem with module ILI9341

Posted by Avatar for user79559 @user79559

Actions