Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] I2C tool #13885

Closed
1 task done
linguini1 opened this issue Oct 7, 2024 · 15 comments · Fixed by #14003
Closed
1 task done

[BUG] I2C tool #13885

linguini1 opened this issue Oct 7, 2024 · 15 comments · Fixed by #14003
Labels
Arch: arm Issues related to ARM (32-bit) architecture Area: Drivers Drivers issues Area: Sensors Sensors issues

Comments

@linguini1
Copy link
Contributor

linguini1 commented Oct 7, 2024

Description / Steps to reproduce the issue

The I2C tool on the Raspberry Pi Pico is incorrectly showing responses on every other address despite not being
connected to any I2C bus.

nsh> i2c dev -b 0 00 77
NOTE: Some devices may not appear with this scan.
You may also try a scan with the -z flag to discover more devices using a zero-byte write request.
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- 02 -- 04 -- 06 -- 08 -- 0a -- 0c -- 0e --
10: 10 -- 12 -- 14 -- 16 -- 18 -- 1a -- 1c -- 1e --
20: 20 -- 22 -- 24 -- 26 -- 28 -- 2a -- 2c -- 2e --
30: 30 -- 32 -- 34 -- 36 -- 38 -- 3a -- 3c -- 3e --
40: 40 -- 42 -- 44 -- 46 -- 48 -- 4a -- 4c -- 4e --
50: 50 -- 52 -- 54 -- 56 -- 58 -- 5a -- 5c -- 5e --
60: 60 -- 62 -- 64 -- 66 -- 68 -- 6a -- 6c -- 6e --
70: 70 -- 72 -- 74 -- 76 --

Tested on 2 different Picos so it should not be a hardware issue.

I have configured the I2C tool, the I2C0 interface and the I2C character driver (I2C master support).

Configuration:

#
# Automatically generated file; DO NOT EDIT.
# NuttX/x86_64 Configuration
#

#
# License Setup
#
# CONFIG_ALLOW_BSD_COMPONENTS is not set
# CONFIG_ALLOW_GPL_COMPONENTS is not set
# CONFIG_ALLOW_MIT_COMPONENTS is not set
# CONFIG_ALLOW_ECLIPSE_COMPONENTS is not set
# CONFIG_ALLOW_ICS_COMPONENTS is not set

#
# Build Setup
CONFIG_HOST_LINUX=y

#
# Build Configuration
#
CONFIG_APPS_DIR="../apps"
CONFIG_BASE_DEFCONFIG="raspberrypi-pico-w:usbnsh-dirty"
CONFIG_BUILD_FLAT=y
# CONFIG_BUILD_2PASS is not set

#
# Binary Output Formats
#
CONFIG_OUTPUT_STRIP_PATHS=y

#
# Customize Header Files
#
CONFIG_ARCH_HAVE_STDARG_H=y
CONFIG_ARCH_HAVE_SETJMP=y
CONFIG_ARCH_NONE_DEBUG_H=y

#
# Debug Options
#
CONFIG_FORTIFY_SOURCE=0
CONFIG_NDEBUG=y
CONFIG_DEBUG_ALERT=y
CONFIG_DEBUG_FEATURES=y

#
# Debug SYSLOG Output Controls
#
CONFIG_DEBUG_ERROR=y
CONFIG_DEBUG_WARN=y
CONFIG_DEBUG_INFO=y

#
# Driver Debug Options
#
# CONFIG_DEBUG_GPIO is not set
CONFIG_DEBUG_I2C=y
CONFIG_DEBUG_I2C_ERROR=y
CONFIG_DEBUG_I2C_WARN=y
CONFIG_DEBUG_I2C_INFO=y
CONFIG_ARCH_HAVE_STACKCHECK=y
CONFIG_STACK_USAGE_WARNING=0
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_SYMBOLS_LEVEL="-g"
CONFIG_ARCH_HAVE_CUSTOMOPT=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_LTO_NONE=y
CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y
CONFIG_DEBUG_LINK_MAP=y

#
# System Type
#
CONFIG_ARCH_ARM=y
CONFIG_ARCH="arm"

#
# ARM Options
#
CONFIG_ARM_TOOLCHAIN_GNU_EABI=y
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_ARMV6M=y
CONFIG_ARCH_CORTEXM0=y
CONFIG_ARCH_FAMILY="armv6-m"
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARM_THUMB=y
# CONFIG_ARM_HAVE_PSCI is not set
CONFIG_ARM_HAVE_WFE_SEV=y
CONFIG_ARCH_HAVE_HARDFAULT_DEBUG=y
#
# ARMv6-M Configuration Options
#

#
# RP2040 Configuration Options
#
CONFIG_RP2040_DMAC=y
CONFIG_RP2040_I2C=y
CONFIG_RP2040_I2C0=y
CONFIG_RP2040_I2C_DRIVER=y
CONFIG_ARCH_TOOLCHAIN_GNU=y

#
# Architecture Options
#
CONFIG_ARCH_DMA=y
CONFIG_ARCH_HAVE_IRQPRIO=y
CONFIG_ARCH_HAVE_MULTICPU=y
CONFIG_ARCH_HAVE_FORK=y
CONFIG_ARCH_HAVE_RESET=y
CONFIG_ARCH_HAVE_TESTSET=y
CONFIG_ARCH_HAVE_THREAD_LOCAL=y
CONFIG_ARCH_HAVE_SYSCALL_HOOKS=y
CONFIG_ARCH_HAVE_BACKTRACE=y
CONFIG_ARCH_HAVE_CPUINFO=y
CONFIG_ARCH_HAVE_TCBINFO=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_STACKDUMP_MAX_LENGTH=0
CONFIG_ARCH_HAVE_RAMVECTORS=y
CONFIG_ARCH_RAMVECTORS=y

#
# Board Settings
#
CONFIG_BOARD_LOOPSPERMSEC=10450

#
# Interrupt options
#
CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
CONFIG_ARCH_INTERRUPTSTACK=0

#
# Boot options
#
CONFIG_BOOT_RUNFROMFLASH=y

#
# Boot Memory Configuration
#
CONFIG_RAM_START=0x20000000
CONFIG_RAM_SIZE=270336

#
# Board Selection
#
CONFIG_ARCH_BOARD_RASPBERRYPI_PICO_W=y
CONFIG_ARCH_BOARD="raspberrypi-pico-w"

#
# Board-Common Options
#
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_RP2040_FLASH_BOOT=y
CONFIG_RP2040_FLASH_CHIP="w25q080"
CONFIG_RP2040_UF2_BINARY=y
CONFIG_RP2040_I2C0_SDA_GPIO=4
CONFIG_RP2040_I2C0_SCL_GPIO=5
CONFIG_BOARDCTL=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_RESET_ON_ASSERT=0
CONFIG_BOARD_ASSERT_RESET_VALUE=1
CONFIG_BOARDCTL_MKRD=y
CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_MEMORY_RANGE=""

#
# RTOS Features
#
CONFIG_DISABLE_OS_API=y
CONFIG_DISABLE_POSIX_TIMERS=y

#
# Clocks and Timers
#
CONFIG_USEC_PER_TICK=10000
CONFIG_START_YEAR=2021
CONFIG_START_MONTH=2
CONFIG_START_DAY=9

#
# Tasks and Scheduling
#
CONFIG_IRQ_NWORKS=8
CONFIG_IRQ_WORK_STACKSIZE=2048
CONFIG_INIT_ENTRY=y
CONFIG_INIT_ARGS=""
CONFIG_INIT_STACKSIZE=2048
CONFIG_INIT_PRIORITY=100
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_ENTRYNAME="nsh_main"
CONFIG_RR_INTERVAL=200
CONFIG_TASK_NAME_SIZE=31
CONFIG_SCHED_WAITPID=y

#
# Pthread Options
#
# CONFIG_PTHREAD_MUTEX_TYPES is not set
CONFIG_PTHREAD_MUTEX_ROBUST=y
CONFIG_PTHREAD_MUTEX_DEFAULT_PRIO_NONE=y

#
# Performance Monitoring
#
CONFIG_SCHED_CPULOAD_NONE=y

#
# System Auto Instrumentation
#
CONFIG_SCHED_STACK_RECORD=0

#
# Files and I/O
#
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_FILE_STREAM=y
CONFIG_NAME_MAX=32
CONFIG_PATH_MAX=256

#
# Signal Configuration
#
CONFIG_SIG_PREALLOC_ACTIONS=4
CONFIG_SIG_ALLOC_ACTIONS=1
CONFIG_SIG_PREALLOC_IRQ_ACTIONS=8

#
# Message Queue Options
#
CONFIG_PREALLOC_MQ_MSGS=8
CONFIG_PREALLOC_MQ_IRQ_MSGS=8
CONFIG_MQ_MAXMSGSIZE=32

#
# Stack and heap information
#
CONFIG_DEFAULT_TASK_STACKSIZE=2048
CONFIG_IDLETHREAD_STACKSIZE=1024
CONFIG_PTHREAD_STACK_MIN=256
CONFIG_PTHREAD_STACK_DEFAULT=2048
CONFIG_PID_INITIAL_COUNT=16

#
# Device Drivers
#
CONFIG_ARCH_HAVE_I2CRESET=y
CONFIG_I2C=y

#
# I2C Slave Support
#
CONFIG_I2C_DRIVER=y

#
# Timer Driver Support
#
CONFIG_ARCH_HAVE_PWM_MULTICHAN=y

#
# LED Support
#
CONFIG_DEV_NULL=y
CONFIG_DEV_OPTEE_NONE=y
CONFIG_DRVR_MKRD=y
CONFIG_ARCH_HAVE_RDWR_MEM_CPU_RUN=y

#
# Relay Support
#
CONFIG_SENSORS=y
CONFIG_SENSORS_SHT4X=y
CONFIG_SHT4X_I2C_FREQUENCY=400000
CONFIG_SHT4X_I2C_ADDR=0x44
CONFIG_SHT4X_LIMIT_HUMIDITY=y
CONFIG_SERIAL=y
CONFIG_SERIAL_REMOVABLE=y
CONFIG_SERIAL_NPOLLWAITERS=4
CONFIG_SERIAL_TXDMA=y
CONFIG_SERIAL_RXDMA=y
CONFIG_USBDEV=y

#
# USB Device Controller Driver Options
#
CONFIG_USBDEV_EPBUFFER_ALIGNMENT=0
CONFIG_USBDEV_BUSPOWERED=y
CONFIG_USBDEV_MAXPOWER=100
CONFIG_USBDEV_TRACE_INITIALIDSET=0

#
# USB Device Class Driver Options
#
# CONFIG_USBDEV_COMPOSITE is not set
# CONFIG_PL2303 is not set
CONFIG_CDCACM=y
CONFIG_CDCACM_CONSOLE=y
CONFIG_CDCACM_HAVE_EPINTIN=y
# CONFIG_CDCACM_IFLOWCONTROL is not set
CONFIG_CDCACM_EP0MAXPACKET=64
CONFIG_CDCACM_EPINTIN=1
CONFIG_CDCACM_EPINTIN_FSSIZE=64
CONFIG_CDCACM_EPBULKOUT=3
CONFIG_CDCACM_EPBULKOUT_FSSIZE=64
CONFIG_CDCACM_EPBULKIN=2
CONFIG_CDCACM_EPBULKIN_FSSIZE=64
CONFIG_CDCACM_NRDREQS=4
CONFIG_CDCACM_NWRREQS=4
CONFIG_CDCACM_BULKOUT_REQLEN=256
CONFIG_CDCACM_BULKIN_REQLEN=96
CONFIG_CDCACM_RXBUFSIZE=257
CONFIG_CDCACM_TXBUFSIZE=193
CONFIG_CDCACM_VENDORID=0x0525
CONFIG_CDCACM_PRODUCTID=0xa4a7
CONFIG_CDCACM_VENDORSTR="NuttX"
CONFIG_CDCACM_PRODUCTSTR="CDC/ACM Serial"

#
# SYSLOG options
#
CONFIG_SYSLOG_MAX_CHANNELS=1

#
# SYSLOG channels
#
CONFIG_SYSLOG_DEVPATH="/dev/ttyS1"
CONFIG_SYSLOG_DEFAULT=y

#
# File system configuration
#
CONFIG_FS_NEPOLL_DESCRIPTORS=8
CONFIG_FS_LOCK_BUCKET_SIZE=0
CONFIG_SENDFILE_BUFSIZE=512
CONFIG_FS_REFCOUNT=y
CONFIG_FS_BACKTRACE=0
CONFIG_FS_MQUEUE_VFS_PATH="/var/mqueue"
CONFIG_FS_MQUEUE_NPOLLWAITERS=4
CONFIG_FS_ANONMAP=y

#
# Partition Table
#
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y

#
# Font Cache Pixel Depths
#
CONFIG_NXFONTS_PACKEDMSFIRST=y

#
# Memory Management
#
CONFIG_MM_DEFAULT_MANAGER=y
CONFIG_MM_DEFAULT_ALIGNMENT=0
CONFIG_MM_REGIONS=1
CONFIG_MM_MAP_COUNT_MAX=1024
CONFIG_MM_HEAP_MEMPOOL_THRESHOLD=-1
CONFIG_MM_BACKTRACE=-1
CONFIG_MM_FREE_DELAYCOUNT_MAX=0

#
# Binary Loader
#
CONFIG_BINFMT_ELF_RELOCATABLE=y

#
# Standard C I/O
#
CONFIG_STDIO_BUFFER_SIZE=64
CONFIG_STDIO_LINEBUFFER=y
CONFIG_NUNGET_CHARS=2

#
# Architecture-Specific Support
#
CONFIG_ARCH_LOWPUTC=y

#
# stdlib Options
#
CONFIG_LIBC_RAND_ORDER=1
CONFIG_LIBC_HOMEDIR="/"
CONFIG_LIBC_TMPDIR="/tmp"
CONFIG_LIBC_MAX_TMPFILE=32
CONFIG_LIBC_MAX_EXITFUNS=0

#
# Program Execution Options
#
CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048
CONFIG_LIBC_HOSTNAME=""
CONFIG_LIBC_OPEN_MAX=256

#
# errno Decode Support
#
# CONFIG_LIBC_STRERROR is not set
CONFIG_LIBC_STRERROR_ERRNUM=y

#
# signal Decode Support
#
CONFIG_LIBC_STRSIGNAL=y

#
# Thread Local Storage (TLS)
#
# CONFIG_TLS_ALIGNED is not set
CONFIG_TLS_NELEM=0
CONFIG_TLS_TASK_NELEM=0
CONFIG_TLS_NCLEANUP=0

#
# NETDB Support
#
CONFIG_LIBC_GAISTRERROR_ERRNUM=y

#
# Non-standard Library Support
#
CONFIG_LIBC_FTOK_VFS_PATH="/var/ftok"
CONFIG_LIBC_MEMFD_ERROR=y
CONFIG_LIBC_MAX_PATHBUFFER=2
CONFIG_LIBC_PATHBUFFER_MALLOC=y
CONFIG_BUILTIN=y

#
# Stream C I/O
#
CONFIG_STREAM_OUT_BUFFER_SIZE=64
CONFIG_STREAM_HEXDUMP_BUFFER_SIZE=128
CONFIG_LIBC_INLINE_QUEUE=y
CONFIG_LIBM_TOOLCHAIN=y

#
# Examples
#
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXAMPLES_HELLO_PROGNAME="hello"
CONFIG_EXAMPLES_HELLO_PRIORITY=100
CONFIG_EXAMPLES_HELLO_STACKSIZE=2048

#
# NSH Library
#
CONFIG_NSH_LIBRARY=y

#
# Command Line Configuration
#
CONFIG_NSH_PROMPT_STRING="nsh> "
CONFIG_NSH_PROMPT_MAX=32
CONFIG_NSH_PROMPT_ENV="PS1"
CONFIG_NSH_PROMPT_SUFFIX="> "
CONFIG_NSH_READLINE=y
CONFIG_NSH_LINELEN=80
CONFIG_NSH_MAXARGUMENTS=7
CONFIG_NSH_NESTDEPTH=3
CONFIG_NSH_ALIAS=y
CONFIG_NSH_ALIAS_MAX_AMOUNT=1
CONFIG_NSH_BUILTIN_APPS=y

#
# Disable Individual commands
#
CONFIG_NSH_DISABLE_LOMTD=y
CONFIG_NSH_DISABLE_MB=y
CONFIG_NSH_DISABLE_MH=y
CONFIG_NSH_DISABLE_MW=y
CONFIG_NSH_DISABLE_SHUTDOWN=y
CONFIG_NSH_DISABLE_TIMEDATECTL=y

#
# Configure Command Options
#
CONFIG_NSH_CODECS_BUFSIZE=128
CONFIG_NSH_PROC_MOUNTPOINT="/proc"
CONFIG_NSH_FILEIOSIZE=1024

#
# Scripting Support
#
CONFIG_NSH_SYSINITSCRIPT="init.d/rc.sysinit"
CONFIG_NSH_INITSCRIPT="init.d/rcS"
CONFIG_NSH_SCRIPT_REDIRECT_PATH=""

#
# Console Configuration
#
CONFIG_NSH_CONSOLE=y
CONFIG_NSH_USBCONSOLE=y
CONFIG_NSH_USBCONDEV="/dev/ttyACM0"
CONFIG_USBDEV_MINOR=0

#
# USB Device Trace Support
#
# CONFIG_NSH_USBDEV_TRACE is not set
CONFIG_NSH_ARCHINIT=y

#
# Telnet Configuration
#
# CONFIG_NSH_LOGIN is not set
# CONFIG_NSH_CONSOLE_LOGIN is not set

#
# Platform-specific Support
#
# CONFIG_PLATFORM_CONFIGDATA is not set

#
# Software Define Radio Libraries
#
# CONFIG_SDR_LIQUID_DSP is not set

#
# System Libraries and NSH Add-Ons
#
# CONFIG_SYSTEM_ARGTABLE3 is not set
# CONFIG_SYSTEM_BATTERYDUMP is not set
# CONFIG_SYSTEM_CDCACM is not set
# CONFIG_SYSTEM_CLE is not set
# CONFIG_SYSTEM_CUTERM is not set
# CONFIG_SYSTEM_DD is not set
# CONFIG_SYSTEM_FDT is not set
# CONFIG_SYSTEM_GDBSTUB is not set
# CONFIG_SYSTEM_HEX2BIN is not set
# CONFIG_SYSTEM_HEXED is not set
# CONFIG_SYSTEM_HOSTNAME is not set
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_I2CTOOL_MINBUS=0
CONFIG_I2CTOOL_MAXBUS=3
CONFIG_I2CTOOL_MINADDR=0x03
CONFIG_I2CTOOL_MAXADDR=0x77
CONFIG_I2CTOOL_MAXREGADDR=0xff
CONFIG_I2CTOOL_DEFFREQ=400000
# CONFIG_LIBUV is not set
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_NSH_PRIORITY=100
CONFIG_SYSTEM_NSH_STACKSIZE=2048
CONFIG_SYSTEM_NSH_PROGNAME="nsh"
# CONFIG_SYSTEM_NXCODEC is not set
# CONFIG_SYSTEM_NXDIAG is not set
# CONFIG_SYSTEM_OFLOADER is not set
# CONFIG_SYSTEM_PING6 is not set
# CONFIG_SYSTEM_PING is not set

#
# psmq requires LOGGING_EMBEDLOG and !DISABLE_MQUEUE
#
# CONFIG_SYSTEM_PTPD is not set
CONFIG_SYSTEM_READLINE=y
CONFIG_READLINE_HAVE_EXTMATCH=y
CONFIG_READLINE_ECHO=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_READLINE_CMD_HISTORY_LINELEN=80
CONFIG_READLINE_CMD_HISTORY_LEN=16

#
# Testing
#
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_GETPRIME_PROGNAME="getprime"
CONFIG_TESTING_GETPRIME_PRIORITY=50
CONFIG_TESTING_GETPRIME_STACKSIZE=2048
CONFIG_TESTING_GETPRIME_THREAD_PRIORITY=10
CONFIG_TESTING_OSTEST=y
CONFIG_TESTING_OSTEST_LOOPS=1
CONFIG_TESTING_OSTEST_STACKSIZE=8192
CONFIG_TESTING_OSTEST_NBARRIER_THREADS=8
CONFIG_TESTING_OSTEST_RR_RANGE=10000
CONFIG_TESTING_OSTEST_RR_RUNS=10
CONFIG_TESTING_OSTEST_WAITRESULT=y

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Linux 5.15.153.1-microsoft-standard-WSL2

NuttX Version

12.6.0-RC1
Also tested 12.7.0-RC0, same issue.

Issue Architecture

[Arch: arm]

Issue Area

[Area: Drivers], [Area: Sensors]

Verification

  • I have verified before submitting the report.
@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture Area: Drivers Drivers issues Area: Sensors Sensors issues labels Oct 7, 2024
@linguini1
Copy link
Contributor Author

I've also noticed through some further testing that I am able to read all the data in an EEPROM that the Pico is connected to on the I2C bus with the i2c dump -a 50 -b 0 -r 0 256 command, but as soon as I then try the i2c dev 00 77 command, I get the incorrect scan results and all subsequent dumps fail.

nsh> i2c dump -a 50 -b 0 -r 0 256
nsh: i2c: too many arguments
DUMP Bus: 0 Addr: 50 Subaddr: 00
00000000  43 55 49 6e 53 70 61 63  65 0d 0a 53 45 4e 2d 42  |CUInSpace..SEN-B|
00000010  3a 20 32 30 32 34 2d 30  32 2d 30 34 0d 0a 4d 53  |: 2024-02-04..MS|
00000020  35 36 31 31 20 37 36 20  37 37 0d 0a 4d 41 58 4d  |5611 76 77..MAXM|
00000030  31 30 53 20 34 32 0d 0a  4c 53 4d 36 44 53 4f 33  |10S 42..LSM6DSO3|
00000040  32 20 36 42 0d 0a 53 48  54 34 31 20 34 34 0d 0a  |2 6B..SHT41 44..|
00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |......|
00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000090  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |........|
000000b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000d0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000e0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |............|
000000f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
nsh> i2c dev 00 77
NOTE: Some devices may not appear with this scan.
You may also try a scan with the -z flag to discover more devices using a zero-byte write request.
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: 00 -- 02 -- -- 05 -- 07 -- 09 -- 0b -- -- 0e -- 
10: 10 -- -- 13 -- -- -- -- 18 -- 1a -- 1c -- 1e -- 
20: -- 21 -- 23 -- 25 -- 27 -- 29 -- 2b -- 2d -- 2f 
30: -- 31 -- -- 34 35 -- -- 38 -- 3a -- -- 3d -- 3f 
40: -- 41 42 -- 44 -- -- -- 48 -- -- -- 4c -- -- -- 
50: 50 -- 52 -- -- 55 -- 57 -- -- 5a -- -- 5d -- 5f 
60: -- -- 62 -- -- 65 -- -- 68 -- -- 6b -- 6d -- 6f 
70: -- 71 -- -- 74 -- -- --                         
nsh> i2c dump -a 50 -b 0 -r 0 256
nsh: i2c: too many arguments
i2ctool: dump: Transfer failed: 1
nsh> 
nsh> i2c dump-a 50 -b 0 -r 0 256
nsh: i2c: too many arguments
i2ctool: dump: Transfer failed: 1
nsh> i2c dump -a 50 -b 0 -r 0 256
nsh: i2c: too many arguments
i2ctool: dump: Transfer failed: 1
nsh> i2c dump -a 50 - 0 -r 0 256
nsh: i2c: too many arguments
i2ctool: dump: Transfer failed: 1

@acassis
Copy link
Contributor

acassis commented Oct 8, 2024

@linguini1 maybe it is some recent regression because it was working few month ago, see:

https://embeddedrelated.com/showarticle/1656.php

@linguini1
Copy link
Contributor Author

@linguini1 maybe it is some recent regression because it was working few month ago

I agree, I had used this tool fairly recently after your article as well. I'm trying to pinpoint when this issue first appears in the commit history; I'm suspecting this may have something to do with the Pico 2.0.0 SDK.

I'm unfortunately quite pressed for time this month but I will see if I can make much progress!

@acassis
Copy link
Contributor

acassis commented Oct 8, 2024

@xiaoxiang781216 this is why we need a hardware CI test urgently. We are breaking NuttX all the time!

@linguini1
Copy link
Contributor Author

I have tried reverting commits on driver/i2c back to this commit: 75fa94a

Dated from before the embedded related article where the i2ctool was working. No change in behaviour, so I don't think any recent commits to the upper level I2C driver has caused this problem.

@linguini1
Copy link
Contributor Author

linguini1 commented Oct 8, 2024

The 12.6 release works using SDK version 1.5.1. Going to continue bisecting.

@linguini1
Copy link
Contributor Author

It does not appear to be the fault of the Pico SDK, everything works fine as of commit 3f00c4a, which is when support for the 2.0.0 SDK was introduced. I can now use git bisect on the NuttX source tree which should help make this faster.

@xiaoxiang781216
Copy link
Contributor

I have tried reverting commits on driver/i2c back to this commit: 75fa94a

Dated from before the embedded related article where the i2ctool was working. No change in behaviour, so I don't think any recent commits to the upper level I2C driver has caused this problem.

this patch only affects I2C slave. @linguini1 could you reverify again?

@linguini1
Copy link
Contributor Author

@xiaoxiang781216 @acassis

From git bisect, it appears the first bad commit is 3b111c8.

@xiaoxiang781216
Copy link
Contributor

@Fix-Point let's try repo on Raspberry Pi Pico.

@Fix-Point
Copy link
Contributor

Could this be related to a watchdog waiting issue? Would it work fine to change the I2C_TIMEOUT from 20*1000/CONFIG_USEC_PER_TICK to 80*1000/CONFIG_USEC_PER_TICK in arch/arm/src/rp2040/rp2040_i2c.c?

@linguini1
Copy link
Contributor Author

@Fix-Point
I tried both lower and faster speeds, the 80 you suggested and also 10. Neither made a difference in the output
unfortunately.

I also suspect that this is related to the watchdog, although I'm wary of fixing the issue on the rp2040 i2c side. Since
this worked before, it means the watchdog changes do not maintain the same watchdog behaviour. There is perhaps other
hardware platforms which have broken from this change, and I think the easiest way to fix them all would be to modify
the watchdog code.

@Fix-Point
Copy link
Contributor

Fix-Point commented Oct 9, 2024

Can you try this patch? #14003

@xiaoxiang781216 xiaoxiang781216 linked a pull request Oct 9, 2024 that will close this issue
@xiaoxiang781216
Copy link
Contributor

@linguini1

@linguini1
Copy link
Contributor Author

Thank you @Fix-Point for your work on this! That patch resolves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: arm Issues related to ARM (32-bit) architecture Area: Drivers Drivers issues Area: Sensors Sensors issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants