Repository : ssh://git@diktynna/doc
On branches: backup-redmine/2021-08-07,backup-redmine/2021-09-11,backup-redmine/2021-10-09,backup-redmine/2021-11-13,backup-redmine/2021-12-11,backup-redmine/2022-01-08,backup-redmine/2022-02-12,backup-redmine/2022-03-12,backup-redmine/2022-04-09,backup-redmine/2022-05-07,backup-redmine/2022-06-11,backup-redmine/2022-08-06,backup-redmine/2022-10-07,backup-redmine/2022-11-14,backup-redmine/2023-01-14,main
commit 35d72fc29368766a763d4951646e7992deb432d3 Author: Sven Eckelmann sven@narfation.org Date: Thu Jul 22 10:39:36 2021 +0000
doc: open-mesh/GDB_Linux_snippets
35d72fc29368766a763d4951646e7992deb432d3 open-mesh/GDB_Linux_snippets.textile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/open-mesh/GDB_Linux_snippets.textile b/open-mesh/GDB_Linux_snippets.textile index 7a2cc865..d43912f1 100644 --- a/open-mesh/GDB_Linux_snippets.textile +++ b/open-mesh/GDB_Linux_snippets.textile @@ -17,3 +17,28 @@ for node in linux.lists.list_for_each_entry(gdb.parse_and_eval("batadv_hardif_li gdb.write("hardif {} belongs to {}\n".format(hardif, softif)) end </pre> + +h2. Working with external Watchdog over GPIO + +There are various boards on ar71xx which use external watchdogs chips via GPIO. They have to be triggered regularly (every minute or even more often) or otherwise the board will just suddenly reboot. This will of course not work when Linux is no longer in control and kgdb/gdb is the only way to interact with the system. + +But luckily, we can just write manually to the ar71xx registers (every n seconds). We have two possible ways: + +* write to the clear/set registers +** set bit n in register GPIO_SET (0x1804000C) to set output value to 1 for GPIO n +** set bit n in register GPIO_CLEAR (0x18040010) to set output value to 0 for GPIO n +* overwrite the complete GPIO_OUT (0x18040008) register (which might modify more GPIO bits then required) + +We will only demonstrate this here for GPIO 12 with GPIO_SET/GPIO_CLEAR. + +<pre> +# check where iomem 018040000-180400ff is mapped to +(gdb) print ath79_gpio_base +$1 = (void *) 0xb8040000 + +# set GPIO 12 to low +(gdb) set {uint32_t}0xb8040010 = 0x00001000 + +# set GPIO 12 to high +(gdb) set {uint32_t}0xb804000C = 0x00001000 +</pre> \ No newline at end of file