1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/samr21-xpro: fix reading EUI-64 from EDBG on cold boot

The samr21 starts up faster than EDBG, so on cold boot reading
the ID will fail.

Fix this by re-trying to get the EUI-64 from EUI.
On warm boot / reset this works on the first try, but on cold boot
it can spin a couple thousand times.
This commit is contained in:
Benjamin Valentin 2020-09-28 16:15:52 +02:00
parent f862166cbb
commit d3cdf26c72

View File

@ -65,7 +65,11 @@ extern "C" {
static inline int _edbg_get_eui64(const void *arg, eui64_t *addr)
{
(void) arg;
return edbg_get_eui64(addr);
/* EDBG can take a while to respond on cold boot */
unsigned tries = 10000;
while (--tries && edbg_get_eui64(addr)) {}
return tries ? 0 : -1;
}
/**