What happened to the D-Link DIR-510L?


#61

I added.

I added all gpio to pinmux.

Done:



#62

Thanks :slightly_smiling_face:

However turns out spawning a new process from within lua takes about 4 milliseconds, while using && to concatenate individual gpio commands can toggle a pin within about 150 µs...

So I was trying to do it rather complicated at first, but then it does not need any sleep in microseconds range at all, just milliseconds for the spacing between pulses...

gpio_start = 11
gpio_end = 13

for pin = gpio_start, gpio_end do
  os.execute("echo '" .. pin .. "' > /sys/class/gpio/export")
end

while true do
  for pin = gpio_start, gpio_end do

    -- set "left bit" (burst start) for trigger
    n = pin + 32

    for i = 5, 0, -1 do
      exp = 2 ^ i
      if n >= exp then
        n = n - exp
        -- write single pulse
        os.execute("echo 'out' > /sys/class/gpio/gpio" .. pin .. "/direction && " ..
                   "echo '0' > /sys/class/gpio/gpio" .. pin .. "/value && " ..
                   "echo '1' > /sys/class/gpio/gpio" .. pin .. "/value && " ..
                   "echo '0' > /sys/class/gpio/gpio" .. pin .. "/value && " ..
                   "echo 'in' > /sys/class/gpio/gpio" .. pin .. "/direction")
      end

      -- inter-pulse interval
      os.execute("usleep 2000")

    end
  end

  os.execute("usleep 100000")

  --break
end

LED on GPIO 11:
pic_61_1

USB 0.5A enable on GPIO 13:
pic_61_2

USB 1A enable on GPIO 12 goes to Pin 7 (CLT2) of TPS2546:
pic_61_3

Will add this to the schematic maybe tomorrow, and do some more GPIO fuzzing (curious about CLT3 :smile: ) ...

However GPIO#0 will cause reset instantly, the shell is just too slow when concatenating pin access with &&, so we probably need a real c program to make the pulses even shorter (if possible at all) or find something else...


#63

It is weird that I can now even

echo "12" > /sys/class/gpio/export
echo "13" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio12/direction
echo "out" > /sys/class/gpio/gpio13/direction
echo "0" > /sys/class/gpio/gpio12/value
echo "1" > /sys/class/gpio/gpio13/value

and both USB ports and the off switch will be working :man_shrugging:
Is there anything different now compared to previous images? I can even export both LEDs and overwrite the current state that was set by bootloader...

Maybe something regarding the UARTF on Pins 7 - 10:

RXD   GPIO#10
CTS_N GPIO#9
TXD   GPIO#8
RTS_N GPIO#7

actually we only need GPIO#10 for receiving the battery status from MSP.

// edit: removed info about weird effects that were due to mechanical connection issues //

Also GPIO 7-10 could not be exported for testing (i.e. I still don't know where CLT 3 and EN of the USB Charger are connected), 10 is obviously for UART RX, but is there some way of configuring only GPIO#10 for hardware UART, but leave the others floating / disable special function? I suspect there might be additional control pins here.

In any case, I hope it will still be wórking when USB pins are exported by default again during boot :slightly_smiling_face:

Maybe it could finally be the last image before PR? :blush: