Conversation
| #include <math.h> | ||
| #include "no_os_rtd.h" | ||
|
|
||
| double no_os_pt1000_resistance_to_temp(double resistance) |
There was a problem hiding this comment.
maybe this driver and the thermocouple one belong to util?
| sdma_ch->hdma->Init.Channel = sdma_ch->ch_num; | ||
| #else | ||
| sdma_ch->hdma->Instance = sdma_ch->ch_num; | ||
| sdma_ch->hdma->Instance = (DMA_Channel_TypeDef *)sdma_ch->ch_num; |
There was a problem hiding this comment.
the changes in stm32_dma should be in separate commit.
| * Copyright 2026(c) Analog Devices, Inc. | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions are met: |
There was a problem hiding this comment.
both no_os_rtd and no_os_thermocouple should have thier own commit.
| * @param priv - Unused. | ||
| * @return Number of bytes written, or negative error code. | ||
| */ | ||
| static int cn0391_iio_read_raw_tc(void *device, char *buf, uint32_t len, |
There was a problem hiding this comment.
this commit should be squashed with the projects commit.
| /** | ||
| * @brief Callendar-Van Dusen equation for Pt1000 RTD (IEC 60751). | ||
| * Converts RTD resistance to temperature. For T < 0°C a Newton-Raphson | ||
| * refinement loop is applied to account for the cubic C term. |
There was a problem hiding this comment.
we don't create patchfixes for stuff added in the same PR.
amiclaus
left a comment
There was a problem hiding this comment.
some comments from my side above, prior to in-depth review.
2c04de4 to
70baf5d
Compare
|
v2:
|
amiclaus
left a comment
There was a problem hiding this comment.
some comments on my side.
| */ | ||
| int stm32_dma_init(struct no_os_dma_desc** desc, | ||
| const struct no_os_dma_init_param* param) | ||
| struct no_os_dma_init_param* param) |
There was a problem hiding this comment.
hmm, why not adding const to the ops signature? the const is correct here we don't want to modify param in the function.
There was a problem hiding this comment.
I agree the "init_params" should be const(the same on CAPI, as a general rule), but in order to remove the compiling error that will be generated beginnig with GCC 14(warnings migrated to errors related to const -> non-const conversion, with the migration to CubeIDE 2.1.0), I've changed the routine definition in this manner bacause:
- There is no general rule on No-OS's drivers initialization routines to receive a const init structure(eg.
no_os_uart_init,no_os_flash_init, ...). - The other solution(to change init function signature on
no_os_dma.handno_os_dma.c) should affect also the other platforms. and more changes should need.
| const struct iio_ch_info *channel, | ||
| intptr_t priv) | ||
| { | ||
| struct cn0391_dev *dev = (struct cn0391_dev *)device; |
There was a problem hiding this comment.
why are these functions outside CN0391_IIO_SUPPORT ?
There was a problem hiding this comment.
These functions exposes the custom AD7124-8 IIO device extension which is used by default, presenting each TC channel as a voltage channel with raw (hot junction temperature in °C) and scale attributes matching the requirements related to integration with current SCOPY implementation for Embedded World Demo.
The IIO device guarded by CN0391_IIO_SUPPORT, will be normally the standard/real IIO profile for CN0391, as soon as the SCOPY will provide a specific plugin for it.
| * @param priv - One of cn0391_iio_attr_id. | ||
| * @return Number of bytes written, or negative error code. | ||
| */ | ||
| static int cn0391_iio_read_processed(void *device, char *buf, uint32_t len, |
There was a problem hiding this comment.
hmm, this function looks similar to cn0391_iio_read_processed. can we have only one implementation?
There was a problem hiding this comment.
You are refering to cn0391_iio_read_raw_tc?
There was a problem hiding this comment.
Throug cn0391_iio_read_processed, the IIO client will be able to access any related parameter from the context of TC channel measurement(more parameters versus cn0391_iio_read_raw_tc, covering the custom IIO device with a single parameter). I should keep it for singular split functionality related to CN0391_IIO_SUPPORT.
The IIO device guarded by CN0391_IIO_SUPPORT, will be normally the standard/real IIO profile for CN0391, as soon as the SCOPY will provide a specific plugin for it.
| no_os_mdelay(2000); | ||
| } | ||
|
|
||
| cn0391_remove(dev); |
There was a problem hiding this comment.
Agree. I'll remove it or I'll integrate it on an exit condition(eg. if more than X consecutive failed reads).
| #endif | ||
| }; | ||
|
|
||
| memcpy(adin1110_ip.mac_address, adin1110_mac_address, NETIF_MAX_HWADDR_LEN); |
There was a problem hiding this comment.
Agree. There was no warning because it is included,I suppose, in one of the lwip headers.
| *rtd_resistance = r_rtd; | ||
|
|
||
| return 0; | ||
| } No newline at end of file |
There was a problem hiding this comment.
nit: new line at EOF missing, detected by github.
| */ | ||
| int stm32_dma_init(struct no_os_dma_desc** desc, | ||
| const struct no_os_dma_init_param* param) | ||
| struct no_os_dma_init_param* param) |
Fix some compiling errors related to GCC 14 toolchain, part of the last CubeIDE 2.1.0. The changes have impact only on STM32 platform and should't affect the other platforms. Signed-off-by: MirceaVlasin <mirceavlasin@yahoo.com>
Add utility modules, to cover conversion for PT1000 RTD and TypeK thermocouple, following the no-OS util convention for platform-agnostic utilities. Signed-off-by: MirceaVlasin <mirceavlasin@yahoo.com>
Add CN0391 board support driver (cn0391.c/h) with full temperature measurement: thermocouple voltage, CJC RTD resistance, cold junction compensation and hot junction temperature across 4 channels (CH0–CH3). Add a maximal CN0391 IIO device(iio_cn0391.c/h) exposing 4 full TC temperature channels with hot_junction_temp, cold_junction_temp, tc_voltage and rtd_resistance attributes. The full CN0391 IIO device is optional via CN0391_IIO_SUPPORT=y. Add a custom AD7124-8 IIO device extension which is used by default, presenting each TC channel as a voltage channel with raw (hot junction temperature in °C) and scale attributes matching the requirements related to integration with current SCOPY implementation. Use single conversion mode for AD7124-8 acquisition, enabling only the 3 required ADC channels (TC/R_REF/RTD) per TC read. Add two build examples: -basic: continuous UART print of CH3 measurements at 2s interval. -iio_lwip: Ethernet IIO server via ADIN1110. Static IP is configurable at build time with ADIN1110_STATIC_IP (default: 192.168.97.60/255.255.0.0). Signed-off-by: MirceaVlasin <mirceavlasin@yahoo.com>
Add minimal project documentation that could be subject of updating (eg. after CN0391 IIO device/plugin will be natively supported by SCOPY). Signed-off-by: MirceaVlasin <mirceavlasin@yahoo.com>
Signed-off-by: MirceaVlasin <mirceavlasin@yahoo.com>
70baf5d to
937028b
Compare
|
v3:
|
| #include "no_os_rtd.h" | ||
|
|
||
| #define CN0391_ADC_RESOLUTION 24 | ||
| #define CN0391_ADC_HALF_RESOLUTION (1 << (CN0391_ADC_RESOLUTION - 1)) |
There was a problem hiding this comment.
this is misleading for 2 reasons:
- #define CN0391_ADC_HALF_RESOLUTION (1 << (CN0391_ADC_RESOLUTION - 1)). are we using only the bipolar mode? or why are we using half resolution?
- #define CN0391_ADC_RESOLUTION 24 should be
1 << 24?
Pull Request Description
Create a project for TypeK thermocouple (TC) data acquisition (Embedded World 2026 demo scope), based on EVAL-ADIN1110EBZ and EVAL-CN0391-ARDZ boards.
Add CN0391 board support driver (cn0391.c/h) with full temperature measurement: thermocouple voltage, CJC RTD resistance, cold junction compensation and hot junction temperature across 4 channels (CH0–CH3).
Add a maximal CN0391 IIO device(iio_cn0391.c/h) exposing 4 full TC temperature channels with hot_junction_temp, cold_junction_temp, tc_voltage and rtd_resistance attributes; the full CN0391 IIO device is optional via CN0391_IIO_SUPPORT=y.
Add a custom AD7124-8 IIO device extension which is used by default, presenting each TC channel as a voltage channel with raw (hot junction temperature in °C) and scale attributes matching the requirements related to integration with current SCOPY implementation.
Add two examples: basic (UART temperature readout) and iio_lwip (Ethernet IIO server via ADIN1110 10BASE-T1L, static IP configurable at build time).
Use single conversion mode for AD7124-8 acquisition, enabling only the 3 required ADC channels (TC/R_REF/RTD) per TC read.
Add minimal project documentation that could be subject of updating (eg. after CN0391 IIO device/plugin will be natively supported by SCOPY).
PR Type
PR Checklist