Conversation
f464efb to
c0503bd
Compare
|
@kister-jimenez i think this is a well made PR, however, could you please check the CI output logs to fix those errors ?
Also, is the Draft label necessary ? I think you can remove it but maybe you have a reason for keeping it ? |
I was planning to complete first the TMC5240 PR before moving this to the active. I'm a bit not sure on the approach I did for the TMC library so I split the PR. |
|
Since the TMC related commits are already into main, I think you can reset them and rebase upon main. |
e4e64a5 to
13a0712
Compare
|
V2:
|
13a0712 to
2949f36
Compare
2341f04 to
11796c5
Compare
11796c5 to
41260cc
Compare
edelweiseescala
left a comment
There was a problem hiding this comment.
Hello sir kit, I just have some question about some flags for the board info library.
Also, some files do not have new line at the end.
| #define DEVICE_NAME "EVAL-ADMT4000ARD1Z" | ||
| #define DEVICE_VENDOR "Analog Devices" | ||
| #ifndef FW_VERSION | ||
| #define FW_VERSION "1.0.0" |
There was a problem hiding this comment.
Keeping FW_version might be confusing, FIRMWARE_VERSION is the one used by get_iio_context_attributes_ex
DEVICE_NAME and DEVICE_VENDOR information is from the eeprom, maybe should also be dropped.
There was a problem hiding this comment.
I removed DEVICE_NAME and DEVICE_VENDOR. I kept the FIRMWARE_VERSION since this is not of part of the information in the EEPROM.
| INCS += $(PROJECT)/src/common/common_data.h | ||
|
|
||
| # Add firmware version definition | ||
| CFLAGS += -DFIRMWARE_VERSION=\"$(FIRMWARE_VERSION)\" No newline at end of file |
There was a problem hiding this comment.
should we keep this here or move it to the src.mk
There was a problem hiding this comment.
I removed this.
2ceeae2 to
e9877a3
Compare
|
V3:
|
|
Hello sir Kit, Just a couple minor suggestions: |
| * writing registers, computing CRC, ECC encoding, and more. | ||
| * @author Marc Sosa (marcpaolo.sosa@analog.com) | ||
| * @author Jose Ramon San Buenaventura (jose.sanbuenaventura@analog.com) | ||
| * @author Louijie Compo (louijie.compo@analog.com) |
There was a problem hiding this comment.
| * @author Louijie Compo (louijie.compo@analog.com) | |
| * @author Louijie Compo (louijie.compo@analog.com) | |
| * @author Kister Jimenez (kister.jimenez@analog.com) |
ditto for other file headers
There was a problem hiding this comment.
I did not write this driver and only did a little cleanup. I wanted to avoid having too many names in the driver.
| temp = no_os_field_get(ADMT4000_LIFE_CTR | ADMT4000_FAULT_MASK, | ||
| buf[3 + 4 * i]); | ||
|
|
||
| *angle_data = no_os_get_unaligned_be16(buf + 1 + 4 * i); |
There was a problem hiding this comment.
ditto
| *angle_data = no_os_get_unaligned_be16(buf + 1 + 4 * i); | |
| *angle_data = no_os_get_unaligned_be16(buf + 1 + ADMT4000_ANGLE_BUF_IDX(i)); |
e9877a3 to
b56b9ae
Compare
b56b9ae to
bcbf260
Compare
|
V4:
|
jemfgeronimo
left a comment
There was a problem hiding this comment.
LGTM overall. Minor comments on formatting and small cleanups.
| ret = admt4000_toggle_cnv(device); | ||
| if (ret) | ||
| return ret; | ||
|
|
||
| return 0; |
There was a problem hiding this comment.
| ret = admt4000_toggle_cnv(device); | |
| if (ret) | |
| return ret; | |
| return 0; | |
| return admt4000_toggle_cnv(device); |
| */ | ||
| static int admt4000_compute_crc(uint32_t data_in, uint8_t *crc_ret) | ||
| { | ||
|
|
There was a problem hiding this comment.
Unnecessary empty line.
|
|
||
| if (xor) | ||
| crc ^= 0x04; | ||
|
|
There was a problem hiding this comment.
Unnecessary empty line.
| return -EINVAL; | ||
|
|
||
| ret = admt4000_reg_read(device, reg_addr, &temp, NULL); | ||
|
|
There was a problem hiding this comment.
Unnecessary empty line.
| ret = admt4000_reg_update(device, ADMT4000_AGP_REG_CNVPAGE, | ||
| ADMT4000_PAGE_MASK, | ||
| no_os_field_prep(ADMT4000_PAGE_MASK, page)); | ||
|
|
There was a problem hiding this comment.
Unnecessary empty line.
| ADMT4000_RISING_EDGE); | ||
| ret = admt4000_reg_update(device, ADMT4000_AGP_REG_CNVPAGE, | ||
| ADMT4000_CNV_EDGE_MASK, temp); | ||
|
|
There was a problem hiding this comment.
You can remove empty line.
| ADMT4000_FALLING_EDGE); | ||
| ret = admt4000_reg_update(device, ADMT4000_AGP_REG_CNVPAGE, | ||
| ADMT4000_CNV_EDGE_MASK, temp); | ||
|
|
There was a problem hiding this comment.
You can remove empty line.
| 13); | ||
|
|
||
| if (is_new_data) | ||
| *is_new_data = (bool)no_os_field_get(ADMT4000_NEW_DATA_MASK, raw_val); |
There was a problem hiding this comment.
| *is_new_data = (bool)no_os_field_get(ADMT4000_NEW_DATA_MASK, raw_val); | |
| *is_new_data = !!no_os_field_get(ADMT4000_NEW_DATA_MASK, raw_val); |
Optional: My preference only, could use !! to normalize to boolean, but (bool) is also fine.
| admt4000_conv_sync_mode_avail[i]); | ||
| if (ret < 0 || ret >= (int)(len - length)) | ||
| return -ENOMEM; | ||
| length += ret; |
There was a problem hiding this comment.
Add empty line before this.
| admt4000_harmonic_corr_src_avail[i]); | ||
| if (ret < 0 || ret >= (int)(len - length)) | ||
| return -ENOMEM; | ||
| length += ret; |
There was a problem hiding this comment.
Add empty line before this.
edelweiseescala
left a comment
There was a problem hiding this comment.
I have no more question regarding how to read the eeprom. I just found this one issue on documentation
| ADMT4000 IIO Driver Initialization Example | ||
| ------------------------------------------ | ||
|
|
||
| .. code-block:: bash |
There was a problem hiding this comment.
I think this should be
| .. code-block:: bash | |
| .. code-block:: c |
c47ff30 to
223c912
Compare
|
V5:
|
|
@kister-jimenez please rebase and then we can perhaps merge |
223c912 to
3d39875
Compare
Add the Precision Converters Library as a git submodule. This library provides functions for reading EEPROM ID information from the boards. Signed-off-by: Kister Genesis Jimenez <kister.jimenez@analog.com>
Signed-off-by: Kister Genesis Jimenez <kister.jimenez@analog.com>
Signed-off-by: Kister Genesis Jimenez <kister.jimenez@analog.com>
Signed-off-by: Kister Genesis Jimenez <kister.jimenez@analog.com>
Signed-off-by: Kister Genesis Jimenez <kister.jimenez@analog.com>
Add project documentation for the ADMT4000 example project. Signed-off-by: Kister Genesis Jimenez <kister.jimenez@analog.com>
3d39875 to
613e510
Compare
|
V6:
|
Pull Request Description
These changes provide support to the ADMT4000 Calibration Kit. The ADMT4000 Calibration Kit contains the ADMT4000 and a motor controller, which in this case is a TMC5240. This also support the variant without the motor controller.
The examples are as follows:
Basic Example - Contains simple firmware exercising some of the ADMT4000 driver APIs.
IIO Trigger Example - Exposes an IIOD. This one is a bit different as I included the use of the board EEPROM so that the firmware and the SDP-K1 can be discoverable in ACE/Eval Studio. The TMC5240 is also instantiated but can include/excluded via make arguments. There is also another IIO driver to expose the GPIOs used for the board that is not part of the chip. This is done so that the ADMT4000 IIO driver can be reused.
PR Type
PR Checklist