Failed to decode board config (EEPROM).
Hi,
I am getting issues with this driver, seems to be an issue with creek EEPROM decode, parsing the bitstream fails no matter how my config looks.
I used stock config to expose the issue here (from original .git master repo) . To double check EEPROM content I used another tool , see output below.
Parsing fails always at: https://github.com/daniel-santos/mcp2210-linux/blob/09e7ba54e7b8ebe0b1e58f0e7dd30a44c96cc21e/mcp2210-lib.c#L757
See full output:
[root@ mcp2210-linux-santos]# LD_LIBRARY_PATH=`pwd`/user user/mcp2210-util encode > config.dat
src->pins[0].name = 0x404f6d ("L6470")
src->pins[0].modalias = 0x404f66 ("spidev")
src->pins[1].name = 0x40522c ("unused%d")
src->pins[1].modalias = (nil) ("")
src->pins[2].name = 0x405235 ("SSPND")
src->pins[2].modalias = (nil) ("")
src->pins[3].name = 0x40523b ("USBLED")
src->pins[3].modalias = (nil) ("")
src->pins[4].name = 0x405242 ("LOWPWR")
src->pins[4].modalias = (nil) ("")
src->pins[5].name = 0x405249 ("USBCFG")
src->pins[5].modalias = (nil) ("")
src->pins[6].name = 0x405250 ("MOTION")
src->pins[6].modalias = (nil) ("")
src->pins[7].name = 0x405257 ("ADNS-9800")
src->pins[7].modalias = 0x405261 ("adns9x")
src->pins[8].name = 0x405268 ("gpio_int%d")
src->pins[8].modalias = (nil) ("")
-------- creek_encode -------- - 0
magic - 32
version - 36
strings present - 54
3wire - 55
pin 0 doesn't have IRQ (pos = 56)
pin 1 doesn't have IRQ (pos = 57)
dedicated pin...
pin 6 has IRQ (pos = 58)
pin 7 has IRQ (pos = 63)
pin 8 has IRQ (pos = 68)
IRQs - 76
gpio polling done - 103
intr polling done - 131
spi data - 208
spi data - 285
name - 325
modalias - 373
name - 437
name - 477
name - 525
name - 573
name - 621
name - 669
name - 741
modalias - 789
name - 869
strings - 869
creek_encode: used 869 bits
encoded into 869 bits (109 bytes)
put_output_data src: 0x7ffd6bec6990, size: 109
[root@ mcp2210-linux-santos]# LD_LIBRARY_PATH=`pwd`/user user/mcp2210-util eeprom write size=109 addr=0 < config.dat
eeprom_read_write: addr 0, size 109
get_input_data dest 0x111d26c, size 109
[root@ mcp2210-linux-santos]# insmod ./mcp2210.ko
[root@ mcp2210-linux-santos]# ./user/mcp2210_bind.sh
/sys/bus/usb/devices /home/cbalint/work/LORA1278/mcp2210/mcp2210-linux-santos
[ 128.701278] mcp2210_init
[ 128.701309] usbcore: registered new interface driver mcp2210
[ 130.940384] usb 3-2: mcp2210_probe
[ 130.940523] This is the initial device state: 00000000c42ae273 struct mcp2210_device {
.udev = f12f0c9a
.intf = d222afa2
.dev_spinlock = unlocked
.queue_spinlock = unlocked
.io_mutex = unlocked
.kref
.manager_running = 0
.cmd_queue = {.next = 2bb3b9dd , .prev = 2bb3b9dd }
.cur_cmd = (null)
.delayed_list = {.next = 5a16b4ab , .prev = 5a16b4ab }
.delayed_cmd = (null)
.timer
[ 130.940529] .eps[EP_OUT] = 0000000039e0d857 struct mcp2210_endpoint {
.ep = 0000000089aa01d0
.urb = 00000000c8c093f3
.buffer = 0000000090b97d69
.submit_time = 0
.unlink_in_process = 1
.state = 0
.is_mcp_endianness = 0
.kill = 0
.is_dir_in = 0
.retry_count = 0
}
[ 130.940534] .eps[EP_IN] = 00000000c5fcceae struct mcp2210_endpoint {
.ep = 000000007f19a3be
.urb = 000000008f1498df
.buffer = 00000000d1df8460
.submit_time = 0
.unlink_in_process = 1
.state = 0
.is_mcp_endianness = 0
.kill = 0
.is_dir_in = 1
.retry_count = 0
}
[ 130.940552] .delayed_work
.dead = 0
.debug_chatter_count = 0
.spi_in_flight = 0
.have_config = 0
.is_spi_probed = 0
.is_gpio_probed = 0
.is_irq_probed = 0
.poll_intr = 0
.poll_gpio = 0
[ 130.940555] .s = 00000000215df315 struct mcp2210_state {
.have_chip_settings = 0
.have_power_up_chip_settings = 0
.have_spi_settings = 0
.have_power_up_spi_settings = 0
.have_usb_key_params = 0
[ 130.940556] .chip_settings = (uninitialized)
[ 130.940556] .power_up_chip_settings = (uninitialized)
[ 130.940557] .spi_settings = (uninitialized)
[ 130.940558] .power_up_spi_settings = (uninitialized)
[ 130.940558] .usb_key_params = (uninitialized)
[ 130.940561] .cur_spi_config = -1
.idle_cs = 0x0000
.active_cs = 0x0000
.spi_delay_per_kb = 0
}
[ 130.940561] .config = (null)
[ 130.940567] .ctl_cmd
.eeprom_spinlock = unlocked
.eeprom_state = {TODO}
.eeprom_cache = {TODO}
.names
.gpio
.spi_master = (null)
.chips[] = {TODO}
.irq_lock = unlocked
.nr_irqs = 0
.irq_base = 0
.irq_revmap[8]
.irq_type[8]
.irq_mask = 0
.last_poll_gpio = 0
.last_poll_intr; = 0
.interrupt_event_counter = 0
.cmd_poll_gpio
.cmd_poll_intr
}
[ 130.961982] usb 3-2: eeprom_read_complete: creek magic detected, reading config from EEPROM
[ 131.956419] -------- creek_decode -------- - 0
[ 131.956421] magic - 32
[ 131.956422] version - 36
[ 131.956424] strings present, count SPI - 54
[ 131.956425] 3wire - 55
[ 131.956426] IRQs - 72
[ 131.956428] gpio polling done - 99
[ 131.956429] intr polling done - 100
[ 131.956430] spi data - 128
[ 131.956434] usb 3-2: creek_configure: Failed to decode board config from MCP2210's user-EEPROM: -71
[root@ mcp2210-linux-santos]# uname -a
Linux 4.19.0-1.fc30.x86_64 #1 SMP Mon Oct 22 14:04:41 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@ mcp2210-linux-santos]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.2.1 20181215 (Red Hat 8.2.1-6) (GCC)
[root@ mcp2210]# ./mcp2210-util /dev/hidraw2 --dump-eeprom
EEPROM dump:
c0 1d f0 0d 72 55 1d 42 18 41 7d 26 7a 47 3a 00
48 64 26 48 03 01 05 11 41 01 47 48 5f 04 23 82
01 02 0c 4a 2c 36 34 b7 70 73 70 69 64 e5 76 75
6e 75 73 65 24 e5 44 53 53 50 ce 44 55 53 42 4c
c5 44 4c 4f 57 50 d7 52 55 53 42 43 c6 47 4d 4f
54 49 cf 4e 41 44 4e 33 2d 39 38 b0 70 61 64 6e
33 f9 78 67 70 69 4f 7f 69 6e 34 e5 04 ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Hello! My apologies for missing your message, I got really sick last December so I guess I didn't see this email.
You may have already solved it or moved on, but I think you've forgotten the step where you set the mcp2210's non-volatile settings. This is stored in the non-user portion of the chip's EEPROM. The two need to match. Perhaps the driver could also try to give a hint about why it fails. :(
LD_LIBRARY_PATH=`pwd`/user user/mcp2210-util set config 31
Kindly let me know. Also thank you for the thorough report!
EDIT: Also you can run mcp2210-util test config to have it verify correctness.