|
| 1 | +ADP5055 no-OS driver |
| 2 | +==================== |
| 3 | + |
| 4 | +Supported Devices |
| 5 | +----------------- |
| 6 | + |
| 7 | +`ADMT4000 <https://www.analog.com/en/products/admt4000.html>`_ |
| 8 | + |
| 9 | +Overview |
| 10 | +-------- |
| 11 | + |
| 12 | +TThe ADMT4000 is a magnetic turn count sensor capable |
| 13 | +of recording the number of rotations of a magnetic |
| 14 | +system even while the device is powered down. |
| 15 | +On power-up, the device can be interrogated to report the |
| 16 | +absolute position of the system. The absolute position |
| 17 | +is reported through a serial-peripheral interface (SPI). |
| 18 | +The ADMT4000 counts up to 46-turns of an external |
| 19 | +magnetic field, which increments the absolute position |
| 20 | +in the clockwise (CW) direction. |
| 21 | +The device includes three magnetic sensors, a giant |
| 22 | +magneto resistance (GMR) turn count sensor, which is |
| 23 | +used to count the number of rotations on the system, a |
| 24 | +GMR quadrant detecting sensor, and an anisotropic |
| 25 | +magnetoresistance (AMR) angle sensor. The AMR angle |
| 26 | +sensor is used in combination with a GMR quadrant |
| 27 | +detecting sensor to determine the absolute position of |
| 28 | +the system within 360°. Combining the GMR turn count |
| 29 | +sensor output with the AMR angle sensor output |
| 30 | +enables the device to report the position of the system |
| 31 | +with a high degree of angular accuracy. |
| 32 | + |
| 33 | +Applications |
| 34 | +------------ |
| 35 | +* Rotation count detection and storage without |
| 36 | +power |
| 37 | +* Contactless absolute position measurement |
| 38 | +* Brushless DC motor control and positioning |
| 39 | +* Actuator control and positioning |
| 40 | + |
| 41 | +ADMT4000 Device Configuration |
| 42 | +---------------------------- |
| 43 | + |
| 44 | +Driver Initialization |
| 45 | +--------------------- |
| 46 | + |
| 47 | +In order to be able to use the device, you will have to provide the support |
| 48 | +for the communication protocol (SPI). |
| 49 | + |
| 50 | +Status Configuration |
| 51 | +-------------------- |
| 52 | + |
| 53 | +Register values of the device can be read using **admt4000_read** API. |
| 54 | +Additionally the register values can be written using **admt4000_write** API. |
| 55 | + |
| 56 | + |
| 57 | +ADMT4000 Driver Initialization Example |
| 58 | +------------------------------------- |
| 59 | + |
| 60 | +.. code-block:: bash |
| 61 | + struct admt4000_desc *admt4000_desc; |
| 62 | + const struct no_os_spi_init_param admt_spi_ip = { |
| 63 | + .device_id = SPI_DEVICE_ID, |
| 64 | + .max_speed_hz = SPI_BAUDRATE, |
| 65 | + .chip_select = SPI_CS, |
| 66 | + .mode = NO_OS_SPI_MODE_0, |
| 67 | + .bit_order = NO_OS_SPI_BIT_ORDER_MSB_FIRST, |
| 68 | + .platform_ops = SPI_OPS, |
| 69 | + .extra = SPI_EXTRA, |
| 70 | + }; |
| 71 | + struct admt4000_init_param admt4000_ip = { |
| 72 | + .spi_init = admt_spi_ip, |
| 73 | + .gpio_coil_rs = gpio_coil_rs_ip, |
| 74 | + .gpio_gpio0_busy = gpio_gpio0_busy_ip, |
| 75 | + .gpio_shdn_n = gpio_shdn_n_ip, |
| 76 | + .dev_vdd = ADMT4000_3P3V, |
| 77 | + }; |
| 78 | + ret = admt4000_init(&admt4000_desc, admt4000_ip); |
| 79 | + if (ret) |
| 80 | + goto exit; |
| 81 | +
|
| 82 | +
|
| 83 | +
|
| 84 | +ADMT4000 no-OS IIO support |
| 85 | +------------------------- |
| 86 | +The ADMT4000 IIO driver comes on top of the ADMT4000 driver and offers support |
| 87 | +for interfacing IIO clients through libiio. |
| 88 | +
|
| 89 | +ADMT4000 IIO Device Configuration |
| 90 | +-------------------------------- |
| 91 | +Attributes |
| 92 | +----------- |
| 93 | +
|
| 94 | +* ``page - sets and reads the page of the register map to be accessed`` |
| 95 | +* ``sequencer_mode - to`` |
| 96 | +* ``angle_filt - toggles the filter for the angle sensor`` |
| 97 | +* ``conversion_mode - toggles and reads the conversion mode`` |
| 98 | +* ``h8_ctrl - toggles the H8 control`` |
| 99 | +* ``sdp_gpio0_busy - gets the status of the GPIO0 busy pin`` |
| 100 | +* ``sdp_coil_rs - sets the coil for GMR reset`` |
| 101 | +
|
| 102 | +ADMT4000 IIO Driver Initialization Example |
| 103 | +----------------------------------------- |
| 104 | +
|
| 105 | +.. code-block:: bash |
| 106 | + int ret; |
| 107 | +
|
| 108 | + struct admt4000_iio_dev *admt4000_iio_desc; |
| 109 | +
|
| 110 | + struct admt4000_iio_dev_init_param admt4000_iio_ip = { |
| 111 | + .admt4000_dev_init = &admt_ip, |
| 112 | + }; |
| 113 | +
|
| 114 | + struct iio_app_desc *app; |
| 115 | + struct iio_app_init_param app_init_param = { 0 }; |
| 116 | +
|
| 117 | + ret = admt4000_iio_init(&admt4000_iio_desc, &admt4000_iio_ip); |
| 118 | + if (ret) |
| 119 | + goto exit; |
| 120 | +
|
| 121 | + struct iio_app_device iio_devices[] = { |
| 122 | + { |
| 123 | + .name = "admt4000", |
| 124 | + .dev = admt4000_iio_desc, |
| 125 | + .dev_descriptor = admt4000_iio_desc->iio_dev, |
| 126 | + }, |
| 127 | + }; |
| 128 | +
|
| 129 | + app_init_param.devices = iio_devices; |
| 130 | + app_init_param.nb_devices = NO_OS_ARRAY_SIZE(iio_devices); |
| 131 | + app_init_param.uart_init_params = uart_ip; |
| 132 | +
|
| 133 | + ret = iio_app_init(&app, app_init_param); |
| 134 | + if (ret) |
| 135 | + goto iio_admt4000_remove; |
| 136 | +
|
| 137 | + ret = iio_app_run(app); |
| 138 | +
|
| 139 | + iio_app_remove(app); |
0 commit comments