diff options
Diffstat (limited to 'microwire.lua')
-rw-r--r-- | microwire.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/microwire.lua b/microwire.lua index 1fc87b4..d50b395 100644 --- a/microwire.lua +++ b/microwire.lua @@ -4,13 +4,13 @@ -- Pins assignment -- SPI Id selects which pins are used for CLK, MOSI, MISO, CS --- lmx2487 can hadle up to 20 MHz but optocoupler is good for 240kHz --- so let's aim to 100 kHz -maxMicrowireInterfaceSpeed = 100000; -- in Hz -spiID = 1; -- HSPI in nodemcu language -databits=24 +spiID = 1; -- ID=1 --> HSPI in nodemcu language +databits=24; -- LMX2487 loads 24 bits sequence per write into a register -- default SPI clock is 80 MHz fSPI = 80000000 +-- lmx2487 can handle up to 20 MHz speed (50 nS per clock) but optocoupler is good for 240kHz +-- so let's aim for 100 kHz +maxMicrowireInterfaceSpeed = 100000; -- in Hz clock_divider = math.floor(fSPI/maxMicrowireInterfaceSpeed) -- we will use SPI ChipSelect pin for LoadEnable pin @@ -39,7 +39,7 @@ end function microwire_send_data( data ) -- essentially send data via spi interface - -- and raise Load Enable pin for a bit (at least for25 nS) at the end of transmission + -- and raise Load Enable pin for a bit (at least for 25 nS) at the end of transmission -- first low LE pin gpio.write(microwire_LE_pin, gpio.LOW) |