• I'm trying to port my NodeMCU code which communicates with the Ti CC1101 modem. Using the NodeMCU ESP8266 board (4MB Flash). I'm using the hardware SPI pins (D5-D7), plus the D8 PIN for chip select.

    The only thing I'm doing so far is trying to reset the modem with the chip select line "wiggling" described in the modem's manual in the section "manual reset". This requires microsecond toggling then issuing an SPI command.

    My code (generated from Typescript):

    var cc1101 = /** @class */ (function () {
        function cc1101(spi, cs) {
            this.spi = spi;
            this.cs = cs;
            spi.setup({});
            this.cs.mode('output');
        }
        cc1101.prototype.sendCmd = function (cmd, cb) {
            this.cs.write(false);
            this.spi.write(cmd);
            this.cs.write(true);
            setTimeout(cb, 0.3, []);
        };
        cc1101.prototype.readReg = function (reg) {
            return this.spi.send(reg, this.cs);
        };
        cc1101.prototype.reset = function (cb) {
            // CS wiggling to initiate manual reset (manual page 45)
            digitalPulse(this.cs, true, [0.03, 0.03, 0.045]);
            digitalPulse(this.cs, true, 0); // Wait for completion
            this.sendCmd(0x30, cb);
        };
        return cc1101;
    }());
    
    function main() {
        var cc = new cc1101(SPI1, NodeMCU.D8);
        cc.reset(function () {
            console.log(cc.readReg(0xf1));
        });
    }
    E.on('init', main);
    

    Uploading with SAVE_ON_SEND using espruino tool, I get this output:

    Espruino Command-line Tool 0.1.30
    -----------------------------------
    
    Explicit board JSON supplied: "ESP8266_4MB"
    Connecting to '/dev/ttyUSB0'
    Connected
    You have pre-1v96 firmware. Upload size is limited by available RAM
    --] 
    --]  ____                 _ 
    --] |  __|___ ___ ___ _ _|_|___ ___ 
    --] |  __|_ -| . |  _| | | |   | . |
    --] |____|___|  _|_| |___|_|_|_|___|
    --]          |_| espruino.com
    --]  2v04 (c) 2019 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 0xe0 chip 0x4016
    --] 
    --] >
    Upload Complete
    --] Uncaught InternalError: Timeout on Utility Timer
    --]  at line 2 col 35
    --]         digitalPulse(this.cs, 1, 0); // Wait for completion
    --]                                   ^
    --] in function "reset" called from line 4 col 6
    --]     });
    --]      ^
    --] in function called from system
    

    What does this mean? The pulse can't be sent? Or is the pulse sending happening so fast that the hardware timer controlling it already finished when I'm invoking the wait so it starves out?
    I should really wait for the pulse to complete, that's when I can send the RST strobe command to the chip.

    My NodeMCU LUA code for the same thing which works can be found here. Maybe it helps.

About

Avatar for nistvan.86 @nistvan.86 started