You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/03/06 10:19:21 UTC
[GitHub] [incubator-nuttx] ReimuNotMoe opened a new issue #2988: STM32L151 I2C problems
ReimuNotMoe opened a new issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988
I'm currently porting NuttX to a new (not publicly released yet) board. It uses STM32L151C8T6-A MCU.
However, I can't properly read data from I2C devices using the i2ctool.
I can list attached devices using `i2c dev 00 7f`, but dumping registers using `i2c dump -b 1 -a <addr> 256` will return garbage data. Sometimes it returns all `ff` and sometimes it returns random values.
I tried messing with the menuconfig options: Alternate implementation, dynamic timeouts, huge timeout values, etc. And none of these worked.
These I2C devices work well with STM32 HAL APIs and a Raspberry Pi.
Please tell me how to solve this problem, thanks in advance.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-808851662
Let's close this issue now, @ReimuNotMoe you can provide a patch to make NuttX i2c-tools more compatible with Linux's version.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ReimuNotMoe edited a comment on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
ReimuNotMoe edited a comment on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-798922955
> Hi @ReimuNotMoe what device are you trying to dump? Do you have a Logic Analyzer to see the bus? Even a "cheaper" logic analyzer can do the trick: https://acassis.wordpress.com/2015/07/19/sigrok-and-a-cheap-saleae-clone-can-save-your-life-i-meant-your-time/
> This way you can compare the i2ctool command from NuttX against STM32 HAL and the Raspberry Pi i2ctool.
I bought a DSLogic Plus logic analyzer and used it to inspect the i2c lines.
**Edit: I selected wrong channels in the previous edit. Here are the correct results.**
It seems that `i2c` is reading "correct" data, I don't know why.
Nuttx dumping an EPSON RTC, all 0xff:


i2ctool output when dumping a MCP23017 I/O expander, garbled data:


Raspi dumping the same EPSON RTC, everything fine:


Raspi dumping the same MCP23017 I/O expander, everything fine:


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] acassis commented on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
acassis commented on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-799482697
Yes, you are right @ReimuNotMoe the NuttX i2ctool needs to duplicate the Linux i2ctool. People can see NuttX as a Linux-like for microcontroler! ;-)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] acassis commented on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
acassis commented on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-798978807
Hi @ReimuNotMoe I just ordered some MCP23017 modules to test. It is not clear what is the expected behavior of the i2ctool dump.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ReimuNotMoe commented on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
ReimuNotMoe commented on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-799475511
> Hi @ReimuNotMoe I just ordered some MCP23017 modules to test. It is not clear for me what is the expected behavior of the i2ctool dump.
I mean the NuttX i2ctool isn't telling the device which register to read from. It didn't write register address to device before initializing incremental read.
Since NuttX is trying to be Linux-ish in all ways (AFAIK), it might be better to make the NuttX i2ctool behave like the one in Linux.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ReimuNotMoe edited a comment on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
ReimuNotMoe edited a comment on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-798922955
> Hi @ReimuNotMoe what device are you trying to dump? Do you have a Logic Analyzer to see the bus? Even a "cheaper" logic analyzer can do the trick: https://acassis.wordpress.com/2015/07/19/sigrok-and-a-cheap-saleae-clone-can-save-your-life-i-meant-your-time/
> This way you can compare the i2ctool command from NuttX against STM32 HAL and the Raspberry Pi i2ctool.
I bought a DSLogic Plus logic analyzer and used it to inspect the i2c lines.
It seems that there are only a bunch of STARTs and STOPs and there are no actual data transfers when running `i2c dump -b 1 -a <addr> 256`, with different devices.

i2ctool output when dumping an EPSON RTC, all 0xff:

i2ctool output when dumping a MCP23017 I/O expander, garbled data:

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ReimuNotMoe edited a comment on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
ReimuNotMoe edited a comment on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-798930547
So after looking these screenshots again and again, I found the problem: (1) NuttX i2ctool isn't sending register addresses to the device (2) NuttX i2ctool uses incremental reading instead of byte-by-byte reading.
I went through the datasheets of both chips, they both support incremental reading, so that isn't a problem.
It looks like not sending register addresses is the real problem. Is this intentional or a standardized behavior?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] acassis commented on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
acassis commented on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-791929842
Hi @ReimuNotMoe what device are you trying to dump? Do you have a Logic Analyzer to see the bus? Even a "cheaper" logic analyzer can do the trick: https://acassis.wordpress.com/2015/07/19/sigrok-and-a-cheap-saleae-clone-can-save-your-life-i-meant-your-time/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ReimuNotMoe commented on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
ReimuNotMoe commented on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-798922955
> Hi @ReimuNotMoe what device are you trying to dump? Do you have a Logic Analyzer to see the bus? Even a "cheaper" logic analyzer can do the trick: https://acassis.wordpress.com/2015/07/19/sigrok-and-a-cheap-saleae-clone-can-save-your-life-i-meant-your-time/
> This way you can compare the i2ctool command from NuttX against STM32 HAL and the Raspberry Pi i2ctool.
I bought a DSLogic Plus logic analyzer and used it to inspect the i2c lines.
It seems that there are only a bunch of STARTs and STOPs and there are no actual data transfers when running `i2c dump -b 1 -a <addr> 256`.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] acassis edited a comment on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
acassis edited a comment on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-791929842
Hi @ReimuNotMoe what device are you trying to dump? Do you have a Logic Analyzer to see the bus? Even a "cheaper" logic analyzer can do the trick: https://acassis.wordpress.com/2015/07/19/sigrok-and-a-cheap-saleae-clone-can-save-your-life-i-meant-your-time/
This way you can compare the i2ctool command from NuttX against STM32 HAL and the Raspberry Pi i2ctool.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ReimuNotMoe edited a comment on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
ReimuNotMoe edited a comment on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-798930547
So after looking at these screenshots again and again, I found these possible problems:
1. NuttX i2ctool isn't sending register addresses to the device.
2. NuttX i2ctool uses incremental reading instead of byte-by-byte reading.
I went through the datasheets of both chips, they both support incremental reading, so that shouldn't be a problem.
**It looks like not sending register addresses is the real problem.** Is this intentional or a standardized behavior?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 closed issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 closed issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ReimuNotMoe edited a comment on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
ReimuNotMoe edited a comment on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-799475511
> Hi @ReimuNotMoe I just ordered some MCP23017 modules to test. It is not clear for me what is the expected behavior of the i2ctool dump.
I mean the NuttX i2ctool isn't telling the device which register to read from. It didn't write register address to device before initializing incremental read. It looks like there's nothing wrong with the hardware drivers.
Since NuttX is trying to be Linux-ish in all ways (AFAIK), it might be better to make the NuttX i2ctool behave like the one in Linux.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] ReimuNotMoe commented on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
ReimuNotMoe commented on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-798930547
So after looking these screenshots again and again, I found the problem: the NuttX i2ctool isn't sending register addresses to the device? Is this intentional or standardized?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] acassis edited a comment on issue #2988: STM32L151 I2C problems
Posted by GitBox <gi...@apache.org>.
acassis edited a comment on issue #2988:
URL: https://github.com/apache/incubator-nuttx/issues/2988#issuecomment-798978807
Hi @ReimuNotMoe I just ordered some MCP23017 modules to test. It is not clear for me what is the expected behavior of the i2ctool dump.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org