To debug this type of problem you need to be able to observe the activity on the SPI bus.

A 4-channel scope would be ideal, but you can do it with a 2-channel scope.

Most likely, you are not routing your "SPI chip select" to the appropriate GPIO pin. That could be caused by several factors.


Can you communicate to other devices on the SPI bus?

If so, then the the problem is most definitely the "chip select".


If not, then you need to observe the bus and determine what is going wrong.

Are you seeing a clean SPI SCLK signal at the sensor pad?

Is the expected data is being transferred outbound on the SPI bus?

Is the sensor chip responding as expected?


Are the signals on all bus wires clean and sharp? Long wires on an 6MHz+ bus create lots of damaging reflections. Long traces/wires  on this type of bus can mean anything over 4 inches. (Actually, the precise definition is that if the electrical signal needs travel to the end of the bus, reflect back; and all reflections reach the output transistor while it is still switching (in the transistor's active region), then the output transistor will absorb the reflection and the signal should be clean. If the reflection arrives later than it will be reflected back over the trace/wire as an extraneous pulse. If that's the case, the bus layout  or the bus timing needs to be fixed.


If all the electrical signals look clean (no noise), but not correct (wrong values), then if the incorrectness is an outbound signal from the MCU and there is a driver problem.

If its an inbound signal from the sensor that's wrong, its either a driver problem (the driver told the sensor the wrong thing to do) or the sensor is broken (it was given the correct command, but did not comply).


This can often become a complex hardware/software problem. (That's what makes these problems fun to solve.)


-Bob


On 12/17/2020 7:09 PM, Marlar Chan wrote:
Dear Nuttx,


I'm trying according to your instructions. But still cannot read sensor. I don't understand why ID is 0x00000000.

Is it related with SPI CS pin. I tried with MEMS Chip select pin to

 1.  ground

     2.  PC1
    3. PF6(NSS pin)

But still I cannot get data from sensor. Can you suggest me please.

And according to your instuction,
$ make menuconfig

Build Setup  --->
Debug Options  --->

[*] Enable Debug Features
[*]   Enable Error Output
[*]     Enable Warnings Output
[*]       Enable Informational Debug Output

[*]   Sensor Debug Features
[*]     Sensor Error Output
[*]     Sensor Warnings Output
[*]     Sensor Informational Output

I enable these in menu config, how can i check sensor error ouput, warning output, etc. Please advise me.


Best Regards,
Marlar
------------------------------------------------------------------------
*From:* Alan Carvalho de Assis <acas...@gmail.com>
*Sent:* Friday, December 11, 2020 7:07 PM
*To:* dev@nuttx.apache.org <dev@nuttx.apache.org>
*Cc:* Shee Cheng Yap <cys...@ntu.edu.sg>
*Subject:* Re: ADXL372 sensor test fail
You need to enable the Sensors debug to see these sensor's messages:

$ make menuconfig

Build Setup  --->
Debug Options  --->

[*] Enable Debug Features
[*]   Enable Error Output
[*]     Enable Warnings Output
[*]       Enable Informational Debug Output

[*]   Sensor Debug Features
[*]     Sensor Error Output
[*]     Sensor Warnings Output
[*]     Sensor Informational Output

BR,

Alan

On 12/11/20, Xiang Xiao <xiaoxiang781...@gmail.com> wrote:
> nuttx/include/errno.h define ENODEV to 19:
> #define ENODEV              19
> and nuttx/drivers/sensors/adxl372.c return ENODEV  if id mismatch:
> static int adxl372_dvr_open(FAR void *instance_handle, int32_t arg)
> {
>   /* Read the ID registers */
>
>   pnpid = adxl372_read_id(priv);
>   priv->readonly = false;
>
>   sninfo("ADXL372_ID = 0x%08x\n", pnpid);
>
>   if ((pnpid & 0xffffff00) != (ADXL372_DEVID_AD_VALUE << 24 |
> ADXL372_DEVID_MST_VALUE << 16 |
>                                ADXL372_PARTID_VALUE << 8))
>     {
>       snwarn("ERROR: Invalid ADXL372_ID = 0x%08x\n", pnpid);
>
>       priv->readonly = true;
>       set_errno(ENODEV);
>     }
> You have to check what's the value in pnpid.
>
> On Fri, Dec 11, 2020 at 2:28 PM Marlar Chan <marlar.c...@ntu.edu.sg> wrote:
>
>> Dear Nuttx,
>>    I'm testing with stm32f429-disco with adxl372 sensor. I tried to run
>> sample demo adxl372_test. Device id is seen on /dev. But sensor cannot
>> start run and i face with the following issue. Please suggest me any idea
>> what is wrong with it.
>>
>> Best Regards,
>> Marlar
>> ------------------------------
>>
>> CONFIDENTIALITY: This email is intended solely for the person(s) named
>> and
>> may be confidential and/or privileged. If you are not the intended
>> recipient, please delete it, notify us and do not copy, use, or disclose
>> its contents.
>> Towards a sustainable earth: Print only when necessary. Thank you.
>>
>

Reply via email to