Author Topic: I2C Acknowledge fail STM32  (Read 22734 times)

0 Members and 1 Guest are viewing this topic.

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3785
  • Country: de
Re: I2C Acknowledge fail STM32
« Reply #25 on: December 26, 2015, 06:29:24 pm »
@Richardman - I would normally agree with porting to a saner API, but that's not always an option. Also ChibiOS doesn't expose all the functionality you may need - their HAL and drivers expose only the basics, anything more platform specific and you are back to writing into registers.

One approach that has worked for me when trying to make some STM32 peripherals work was to examine the peripheral registers and compare with the reference manual whether the values are sensible. Basically walk through the documentation for the peripheral from top to bottom and check each register. STM32 has most registers working in such way that the defaults (zeros) are typically the values you will most commonly want, so not many bits need to be set. That approach let me discover some bits that the STDPeriph library wasn't setting and thus my code wasn't working. The same with ChibiOS or Cube/HAL.

Tie this with some hardware analyzer - either a scope or logic analyzer and you are golden. I prefer scope for the initial troubleshooting, because a logic analyzer will not show issues like a signal distortion due to two chips attempting to drive the line at the same time (e.g. because pin mode has been configured wrong or assigned to an incorrect alternate function).

The HAL is bloated, poorly documented and buggy, but it is not THAT unusable. It works for many common cases without issues. Whether or not you use HAL makes no difference if you are debugging without adequate instruments - you will be still facing the same issues trying to make ChibiOS or whatever else to work.
 

Offline richardman

  • Frequent Contributor
  • **
  • Posts: 427
  • Country: us
Re: I2C Acknowledge fail STM32
« Reply #26 on: December 26, 2015, 11:01:09 pm »
Definitely agree that the OP should get a scope or analyzer. A USB based one is around $100. That would save  :popcorn: days of work
// richard http://imagecraft.com/
JumpStart C++ for Cortex (compiler/IDE/debugger): the fastest easiest way to get productive on Cortex-M.
Smart.IO: phone App for embedded systems with no app or wireless coding
 

Offline kannan

  • Newbie
  • Posts: 1
  • Country: in
Re: I2C Acknowledge fail STM32
« Reply #27 on: May 20, 2023, 07:06:11 am »
i am issueing the same problem can you please give me your code
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3785
  • Country: de
Re: I2C Acknowledge fail STM32
« Reply #28 on: May 20, 2023, 11:25:45 am »
i am issueing the same problem can you please give me your code

Dude, you realize that this thread is 8 years old, right?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf