Avatar for cozezien

cozezien

Member since Jun 2020 • Last active May 2021
  • 3 conversations
  • 6 comments

Most recent activity

  • in Puck.js, Pixl.js and MDBT42
    Avatar for cozezien

    I'm looking to improve the NFC performance of the Pixeljs, as it's under the screen, I'm going to move it on the other side of the board (picture attached). The position isn't stable (the ribbon cable works though), but long term I'd like to reverse the screen (second picture).

    Is there an easy(ish) way for adapting the ribbon cable connector? I've never done this, but hopefully there would be an adapter that could plug into the current socket to reverse and flip the connector pins.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for cozezien

    I was considering that, but after much experimentation with the pins I've been able to get it to work better. In the images (and code) you'll see I'm using the A* header for connections. I found that the MISO pin seems to have an issue in the A* header. If I nudge the pin while it's in the A* header the card will initialize immediately (the nudge might temporarily disconnect it?).

    If I move the MISO pin in the D* headers it will not need any nudge etc for it to work on the first/second try

    Is there something special about the A* headers as compared to the D* header? I'm not sure why it would behave differently.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for cozezien

    So it's something to do with the MISO connector. No resistor seems to be needed either. Will need to investigate more

  • in Puck.js, Pixl.js and MDBT42
    Avatar for cozezien

    I've been able to get an SD card to work on my pixl, but I'm having trouble to get the initialization process to be consistent. Sometimes the card will start to work within a few seconds (rare) and other times I've left it for about 30 minutes (or overnight) and it still doesn't initialize properly. Once initialized as long as I don't turn the pixl off/on it will work and I can read/write OK.

    I'm using a Sandisk 16GB microsd and I've soldered connectors for a microsd->SD card adapter as per https://www.espruino.com/File+IO

    the error I get when trying to reddir is:

    Uncaught Error: Unable to mount media : NOT_READY
    at line 1 col 27

    things I've tried:

    1. trying different microsd cards
    2. Pull-up resistors on the CS pin (1k,2.7k, 3.7k, 4.7k,16k,50K, 76K) - I haven't noticed any difference / improvement from using the pull up resistors
    3. manually running the initialization/reddir function in the left side of the interface when connected to the card

    I've come up with a simple oninit function that will iterate through trying to get the card to work:

    function onInit() {
    SPI1.setup({miso:A0,sck:A1,  mosi:A2, baud: 1000000 });
    E.connectSDCard(SPI1,A5 /*CS*/);            
    counter = 0;
    
      intval = setInterval( function () {
    
      try {
        let directories = require("fs").readdirSync();
        clearInterval(intval);
        LED1.reset();
        Terminal.println("worked after: " + counter + " times");
      } catch (error) {
        
        counter += 1;
        
        if (counter%2 == 0){
          LED1.set();
        } else {
          LED1.reset();
          }
        
        if (counter%15==0){
          Terminal.println("tried: " + counter + " times");
        }
        }
      }, 1000);
    }
    
    Terminal.println("Initializing SD card");
    

    I've attached a few pictures to show my setup (3 resistors with ~75K ohm). Perhaps I've wired something up wrong?

    Any other suggestions on how I could troubleshoot this? Sadly I don't have an oscilliscope or that sort of thing for analyzing data lines etc

  • in Puck.js, Pixl.js and MDBT42
    Avatar for cozezien

    I'll give the compression a try and see how much that helps before I head down either the custom firmware route or SD card route

    Thanks!

  • in Puck.js, Pixl.js and MDBT42
    Avatar for cozezien

    Hi there,

    I'm looking to store some data files on my pixljs (it's got 512 KB total flash - yay). However when I was doing some testing I found that the available flash storage is quite a bit lower. I ran the following code:

    //cleanup existing flash storage
    storage = require("Storage");
    storage.list().forEach(function(fname){ 
      console.log(fname); 
      storage.erase(fname);
    });
    
    // fill er up
    var i;
    var packages_written = 0;
    for (i = 0; i < 512; i++) {
      data = new Uint8Array(1000);
      storage.write(i.toString(), data);
      console.log("wrote: " + i);
    }
    

    This ended up writing 33 files (so ~33KB of storage). I'm looking to store about 360KB of binary data files (though that seems to be doubtful at the moment).

    Anyone have pointers on optimizations I can do to increase the flash storage? I rather liked not having to use an SD card and holding everything on the device. Additionally is there an easy way to identify when the local flash storage is full (I was looking through the API and didn't see any good methods of doing that).

    Thanks in advance

Actions