Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

ADXL345 Accelerometer Sensor Driver installation fails with power failure

manimehalaismanimehalais Member Posts: 7

Hi,

I am testing the default ADXL345 accelerometer sensor driver in our custom board.

Always the driver enters OnD0Entry and goes immediately to OnD0Exit. Following this, the driver gets unloaded.

In device driver menu, yellow bang with device power failure is shown.

Please guide on how to debug this?

Thanks,

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,663

    You’re not giving us much to go on. We’re not all miraculously familiar with that part, or that driver.

    How is it connected to the system (I2C, SPI, usb, pci)…. Have you tried multiple systems… sounds like a hardware issue to me.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • manimehalaismanimehalais Member Posts: 7
    Sorry for not giving much details.

    It is connected to the system via I2C.

    I am trying to use this driver https://github.com/microsoft/windows-driver-samples/tree/master/sensors/ADXL345Acc

    In Asl code I have updated the I2C part number and Gpio pin number to match the board.

    First I faced I2C access issue and changing from exclusive file access to file read/write resolved the issue. After resolving the issue, the driver always goes to D0exit. I tried to get the state it is transitioning and it showed up as state 5.

    The result is driver gets unloaded with power failure error.
  • manimehalaismanimehalais Member Posts: 7

    Log from the driver

    00000001 ADXL345Acc 2672 9088 2 1 08\31\2021-00:51:22:923 SENSOR DriverEntry FunctionEnter
    00000002 ADXL345Acc 2672 9088 2 2 08\31\2021-00:51:22:924 SENSOR DriverEntry FunctionExit: STATUS_SUCCESS
    00000003 ADXL345Acc 2672 9088 1 3 08\31\2021-00:51:22:928 SENSOR _ADXL345AccDevice::OnDeviceAdd FunctionEnter
    00000004 ADXL345Acc 2672 9088 1 4 08\31\2021-00:51:22:929 SENSOR _ADXL345AccDevice::OnDeviceAdd FunctionExit: STATUS_SUCCESS
    00000005 ADXL345Acc 2672 9088 2 5 08\31\2021-00:51:22:931 SENSOR _ADXL345AccDevice::OnPrepareHardware FunctionEnter
    00000006 ADXL345Acc 2672 9088 2 6 08\31\2021-00:51:22:931 SENSOR _ADXL345AccDevice::Initialize FunctionEnter
    00000007 ADXL345Acc 2672 9088 2 7 08\31\2021-00:51:22:932 SENSOR _ADXL345AccDevice::Initialize FunctionExit: STATUS_SUCCESS
    00000008 ADXL345Acc 2672 9088 3 8 08\31\2021-00:51:22:940 SENSOR _ADXL345AccDevice::ConfigureIoTarget FunctionEnter
    00000009 ADXL345Acc 2672 9088 3 9 08\31\2021-00:51:22:940 ACC _ADXL345AccDevice::ConfigureIoTarget I2C resource found.
    00000010 ADXL345Acc 2672 9088 3 10 08\31\2021-00:51:22:940 ACC _ADXL345AccDevice::ConfigureIoTarget GPIO interrupt resource found.
    00000011 ADXL345Acc 2672 9088 2 11 08\31\2021-00:51:22:946 SENSOR _ADXL345AccDevice::ConfigureIoTarget FunctionExit: STATUS_SUCCESS
    00000012 ADXL345Acc 2672 9088 2 12 08\31\2021-00:51:22:946 SENSOR _ADXL345AccDevice::OnPrepareHardware FunctionExit: STATUS_SUCCESS
    00000013 ADXL345Acc 2672 9088 2 13 08\31\2021-00:51:22:946 SENSOR _ADXL345AccDevice::OnD0Entry FunctionEnter
    00000014 ADXL345Acc 2672 9088 2 14 08\31\2021-00:51:22:946 ACC _ADXL345AccDevice::PowerOn Write Register 2d Value 0
    00000015 ADXL345Acc 2672 9088 2 15 08\31\2021-00:51:22:958 ACC _ADXL345AccDevice::PowerOn Write Register 31 Value b
    00000016 ADXL345Acc 2672 9088 2 16 08\31\2021-00:51:22:958 ACC _ADXL345AccDevice::PowerOn Write Register 38 Value 0
    00000017 ADXL345Acc 2672 9088 2 17 08\31\2021-00:51:22:958 ACC _ADXL345AccDevice::PowerOn Write Register 2c Value 7
    00000018 ADXL345Acc 2672 9088 2 18 08\31\2021-00:51:22:958 ACC _ADXL345AccDevice::PowerOn Write Register 24 Value 1
    00000019 ADXL345Acc 2672 9088 2 19 08\31\2021-00:51:22:959 ACC _ADXL345AccDevice::PowerOn Write Register 27 Value f0
    00000020 ADXL345Acc 2672 9088 2 20 08\31\2021-00:51:22:959 ACC _ADXL345AccDevice::PowerOn Write Register 2f Value ef
    00000021 ADXL345Acc 2672 9088 2 21 08\31\2021-00:51:22:959 SENSOR _ADXL345AccDevice::OnD0Entry FunctionExit: STATUS_SUCCESS
    00000022 ADXL345Acc 2672 9088 2 22 08\31\2021-00:51:22:959 SENSOR _ADXL345AccDevice::OnD0Exit FunctionEnter
    00000023 ADXL345Acc 2672 9088 2 23 08\31\2021-00:51:22:959 ACC _ADXL345AccDevice::OnD0Exit TargetState 5
    00000024 ADXL345Acc 2672 9088 0 24 08\31\2021-00:51:22:960 SENSOR _ADXL345AccDevice::OnD0Exit FunctionExit: STATUS_SUCCESS
    00000025 ADXL345Acc 2672 9088 0 25 08\31\2021-00:51:22:960 SENSOR _ADXL345AccDevice::OnReleaseHardware FunctionEnter
    00000026 ADXL345Acc 2672 9088 2 26 08\31\2021-00:51:22:961 SENSOR _ADXL345AccDevice::OnReleaseHardware FunctionExit: STATUS_SUCCESS
    00000027 ADXL345Acc 2672 9088 1 27 08\31\2021-00:51:22:962 SENSOR OnDriverUnload FunctionEnter
    00000028 ADXL345Acc 2672 9088 1 28 08\31\2021-00:51:22:962 SENSOR OnDriverUnload FunctionExit: STATUS_SUCCESS

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,663

    Yeah…. Looks like the device is being powered down.

    Does the driver implement power-down idle (are you calling WdfDeviceAssignS0IdleSettings)? Because that would certainly cause what you’re seeing.

    Or… to repeat myself:

    Have you tried multiple systems… sounds like a hardware issue to me.

    Maybe put a bus monitor on the I2C?

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • manimehalaismanimehalais Member Posts: 7
    > @"Peter_Viscarola_(OSR)" said:
    > Yeah…. Looks like the device is being powered down.
    >
    > Does the driver implement power-down idle (are you calling WdfDeviceAssignS0IdleSettings)? Because that would certainly cause what you’re seeing.
    >
    > Or… to repeat myself:
    >
    > Have you tried multiple systems… sounds like a hardware issue to me.
    >
    > Maybe put a bus monitor on the I2C?
    >
    > Peter


    I haven't tried multiple systems as I have only one system with the sensor integrated.
    Driver doesn't implement/call WdfDeviceAssignS0IdleSettings
  • manimehalaismanimehalais Member Posts: 7

    The device receives DoExit with Transition state D3 cold

    Need few clarifications
    1) Does I2c bus send this transition state or else which component sends?

    2) is it possible to exclude d3 state

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,093

    1) Does I2c bus send this transition state or else which component sends?

    I2C is an extremely simple bus. It has no concept of power states. You would be getting the request from the operating system, and it's up to you to decide how to respond.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,663
    edited September 2

    You’re getting a transition to D3 cold without opting-in for “cold” support?

    That’s odd as well.

    OK…. Let’s ignore the cause and go for the symptoms: Try calling WdfStopIdle and see if that solves the problem.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • manimehalaismanimehalais Member Posts: 7

    I finally removed an interrupt entry in ASL file and with this change, the driver gets installed. We have contacted BIOS team for an updated BIOS.

    As per the code, the device is configured for measurement in SensorConfig.EvtSensorStart = ADXL345AccDevice::OnStart;

    But using traceview, I am not able to see that it enter OnStart function. When is this function called.

  • rusakov2rusakov2 Member Posts: 54

    @manimehalais said:
    I finally removed an interrupt entry in ASL file and with this change, the driver gets installed. We have contacted BIOS team for an updated BIOS.

    Some time ago I wrote a similar umdf driver for a more complex chip, for BNO055. No ASL was needed to change for it to work in Windows 10, just load as umdf driver, and it is recognized as valid sensor class device.

    For the example you are using please note that

    // 0a. Copy ASL.exe to your development board
    zzz
    // 6. Restart your development board

    Instructions refer to some development board, hence a change in ASL since it is not just i2c sensor, it needs to be wired to GPIO pin for interrupts, i.e. GPIO will be involved on development board.
    Perhaps you got it working on your computer without interrupts, since you are not using development board.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 15 November 2021 Live, Online
Writing WDF Drivers TBD Live, Online
Developing Minifilters 7 February 2022 Live, Online
Kernel Debugging 21 March 2022 Live, Online