cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, I need to communicate the LSM202AGR accelerometer with I2C . Can you help? Some hints ? The info included in datasheet is not very usefull.

DrAK
Associate II
 
24 REPLIES 24

Sorry, I didn't see a question other than a request to correct the code. However, rarely someone will change the given code here, but will give hints on how to do it yourself.

So you could write it immediately. I was waiting for you answer and I thought you need time to make an appropriate research.

But it would be helpful to read the introductions that you can find at the very bottom of the main Github site and at the device driver site, in your case the driver site of the LSM303AGR.

So you are telling me that in order to drink a glass of milk, I must buy a cow or better the whole herd ??

I would not call this way as "support" and this does not encourage fro working with your products !!

Besides I din not find the information included in the links you included as useful but rather as worthless.

The main site also contains an example .ioc file for the NucleoF411, see here, which can be used as a template.

are you sure I may use .ioc targeted for NucleoF411 with G071RB ??

And you did not answer the last question. What with the variable hi2c1 ??

Just read carefully what - I asked about that at the very end.

I am deeply saddened that I could not give appropriate answers. This is an E2E community where the participants actually help each other. As can be read in the rules, this forum does not guarantee direct support from ST:

This is a public community where we strongly encourage collaboration and knowledge sharing. While ST experts do participate in answering questions, we welcome and rely also on the vast knowledge of our customers to help their peers and share their experiences. ST does not guarantee responses to every question posted in the community, yet we will provide programs and engagement to make the response rate and availability of useful content as high as possible.

If you are dissatisfied and have urgent questions, you can open a personal ticket with the online support directly with your login.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
DrAK
Associate II

well, I as so that you're an ST Employee, I was convinced it is just the case that you want to support me on behalf of your company. Just cancel your title, and such misunderstandings will not happen. I wasted almost a fortweek waiting for a sensible answer/solution of my problem, Peter. And my boss demands progress and insists !

regards,

By the way - because you mentioned that you wanted to use many of the NUCLEO boards: to avoid problems later, you and your boss should read the Evaluation Board Terms of Use of the NUCLEO-G071RB. Under Restrictions and Warnings you will find (excerpt):

The Evaluation Board offers limited features and is conceived to be used only to evaluate and test ST products in a research and development setting.

[...]

The Evaluation Board shall not be, in any case, directly or indirectly assembled as a part in any production of Yours as it is solely developed to serve evaluation and testing purposes and has no direct function and is not a finished product.

[...]

You shall not use, in whole or in part, the Evaluation Board in a production system. Except as provided in this Agreement or as explicitly permitted in the documentation of the Evaluation Board, You may not reproduce the Evaluation Board or modify, reverse engineer, de-compile or disassemble its software and/or firmware, in whole or in part.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Is this your first STM32 project? Sometimes peripheral handles can be confusing.

Anyway, as Peter said, the link (https://github.com/STMicroelectronics/lsm303agr/tree/b03141c1fb94fe2d6a523d01af792184863ed0e8) explains how to "talk" with the sensor.

Don't know how to effectively use the libraries, but it seems to be commented with useful infos about the various functions. E.g

/**
  * @brief  Temperature data available.[get]
  *
  * @param  ctx    Read / write interface definitions.(ptr)
  * @param  val    Get the values of tda in reg STATUS_REG_AUX_A.(ptr)
  * @retval        Interface status (MANDATORY: return 0 -> no Error).
  *
  */

Your problem is how to use the library or how to talk with the sensor?

If it's the latter, I suggest creating a new project with an i2c enabled and follow the steps in https://github.com/STMicroelectronics/lsm303agr/tree/b03141c1fb94fe2d6a523d01af792184863ed0e8 (2. Integration Details) Read carefully what the guide asks you to do, as to me it seems clear.

If this works, then importing working examples should be easier.

@DrAK​ I forgot, if it's your first STM32 project I suggest playing around with that nucleo for a bit, even with other peripherals, just to grasp the basics of STM32CubeIDE environment and code generator (handles, places to write user code, HAL functions ecc...). Take the time you need, don't give in to the pressure.

Thanks for your answer, but I think you did not read all.

I did read that in GLab. But the problem is that I have another board than that from the examples and the way Peter suggested me how to customize them, does not work.

So if you have a working STM32CubeIDE project which works with G071RB and LSM303AGR you could share it with me, and then there is a chance I can customize that or try to make run the codes I appended a few days ago.

What do you mean "i did read that in GLab" sorry?

So, if I understood, you have an example code for that sensor that works with other MCUs and you have to adapt that source for G071RB. Right?

Unfortunately I don't use that sensor. What I was writing was my approach with other driver libraries from ST that I tried to use. Didn't customize the examples, started from scratch on a clean project after reading the examples. The approach was similar to the one that the Github guide describes.

If the variable is not seen, make it global or declare it extern in the file that needs it.

I still think it would be better to do it from scratch, then, once communication is working properly, copy the application code to your project.

Ok let me take a step back to understand better and sharpen my guesswork.

Aside from trying to port the example file made from another board to your hardware, what did you do, concretely?

Have you managed to run a program on your hardware?

If so, what went wrong? (communication not present/garbage data ecc...)