Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 55:215da406282b, committed 2020-02-24
- Comitter:
- Vkadaba
- Date:
- Mon Feb 24 07:04:35 2020 +0000
- Parent:
- 54:31921ad29828
- Child:
- 56:38b36e947602
- Commit message:
- Added readMbedVersion functionality
Changed in this revision
--- a/bridge_4w_load_cell_config.c Wed Feb 19 10:08:13 2020 +0000
+++ b/bridge_4w_load_cell_config.c Mon Feb 24 07:04:35 2020 +0000
@@ -75,7 +75,7 @@
.offsetAdjustment = 0.0,
.gainAdjustment = 0.0,
.sensorParameter = 0.0,
- .measurementsPerCycle = 10,
+ .measurementsPerCycle = 1,
.cycleSkipCount = 0,
.extraSettlingTime = 5,
.priority = 0,
--- a/common/platform.h Wed Feb 19 10:08:13 2020 +0000
+++ b/common/platform.h Mon Feb 24 07:04:35 2020 +0000
@@ -83,7 +83,7 @@
.sckPin = PLATFORM_SPI_SCK, \
.csPin = PLATFORM_SPI_CS, \
.wakeupPin = PLATFORM_SPI_WAKEUP, \
- .maxSpeedHz = 1000000, \
+ .maxSpeedHz = 2000000, \
}, \
.gpio = { \
.resetPin = PLATFORM_GPIO_RESET, \
--- a/common/utils.c Wed Feb 19 10:08:13 2020 +0000
+++ b/common/utils.c Mon Feb 24 07:04:35 2020 +0000
@@ -132,7 +132,7 @@
uint32_t nNumSamples,
ADMW_MEASUREMENT_MODE eMeasurementMode)
{
-
+ static uint32_t samplesCounter;
for (uint32_t i = 0; i < nNumSamples; i++) {
ADMW_LOG_INFO("Sample # %2d Channel # %2d :: Raw %X %f :: Processed %f :: flags:%s%s",
i+1,
@@ -142,6 +142,8 @@
pSampleBuffer[i].status & ADMW_DEVICE_STATUS_ERROR ? " ERROR" : "",
pSampleBuffer[i].status & ADMW_DEVICE_STATUS_ALERT ? " ALERT" : "");
}
+ samplesCounter++;
+ ADMW_LOG_INFO("Sample count=%d",samplesCounter);
}
static void gpioCallbackFn(ADMW_GPIO_PIN ePinId, void * pArg)
@@ -237,7 +239,7 @@
ADMW_MEASUREMENT_MODE eMeasurementMode)
{
ADMW_RESULT res;
-
+ static uint32_t samplesLost;
volatile bool bDataReady = false;
volatile bool bError = false;
volatile bool bAlert = false;
@@ -314,8 +316,11 @@
* be non-zero for some channels, resulting in
* variable-length sequences
*/
+
ADMW_LOG_DEBUG("Retrieved %u of %u requested data samples",
nReturned, nSamplesPerDataready);
+ samplesLost++;
+ ADMW_LOG_INFO("samples lost=%d",samplesLost);
continue;
} else {
ADMW_LOG_WARN("Failed to get data samples from device");
--- a/inc/admw_api.h Wed Feb 19 10:08:13 2020 +0000 +++ b/inc/admw_api.h Mon Feb 24 07:04:35 2020 +0000 @@ -769,6 +769,7 @@ ADMW_RESULT admw1001_sendRun( ADMW_DEVICE_HANDLE const hDevice); ADMW_RESULT admw_deviceInformation(ADMW_DEVICE_HANDLE hDevice); +ADMW_RESULT admw_readMbedVersion(); #ifdef __cplusplus }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/mbedVersion.h Mon Feb 24 07:04:35 2020 +0000 @@ -0,0 +1,29 @@ +/* +Copyright (c) 2019 by ADI. This model is the confidential and +proprietary property of ADI and the possession or use of this +file requires a written license. + * + *****************************************************************************/ + +/*! + ****************************************************************************** + * @file: + * @brief: Placeholder for revision numbers + *----------------------------------------------------------------------------- + */ +#ifndef __VERSION_H__ +#define __VERSION_H__ + +/* + * Use a 32-bit versioning scheme that supports numerical compares + * Version number is read as MAJOR.MINOR build, e.g. + * 1.12 build 55 + * Note: numbering format is binary coded decimal for ease of reading in debug + * environment. + */ +#define MBED_HOST_MAJOR 0x01 +#define MBED_HOST_MINOR 0x12 +#define MBED_HOST_BUILD 0x0061 + + +#endif
--- a/main.cpp Wed Feb 19 10:08:13 2020 +0000
+++ b/main.cpp Mon Feb 24 07:04:35 2020 +0000
@@ -1,3 +1,4 @@
+
/*
Copyright 2019 (c) Analog Devices, Inc.
@@ -81,7 +82,7 @@
ADMW_DEVICE_HANDLE hDevice;
ADMW_MEASUREMENT_MODE eMeasurementMode = ADMW_MEASUREMENT_MODE_NORMAL;
bool bDeviceReady;
-
+ admw_readMbedVersion();
/*
* Open an ADMW1001 device instance.
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed_release.txt Mon Feb 24 07:04:35 2020 +0000 @@ -0,0 +1,23 @@ +================================================================================ += Mbed Host Firmware = += = += Release notes = +================================================================================ + +================================================================================ +v01.02.0002 (18 February 2020) +-------------------------------------------------------------------------------- +- Added support to load Look up table +- Printing correct Raw values from the sensor +- Added funcionality to read the Mbed FW version +- Added release notes +================================================================================ + +v01.01.0001 (18 February 2020) +-------------------------------------------------------------------------------- +- Changed ADMW_CONFIG struct variable name to "meassureware_config" inroder to load the config/design file downloaded from MW designer +- Added wakeup functinality support. +- Added support for ADT7420 +- Added support for DRDY_PER_FIFO_FILL mode +- Supporting the the Device FW v1.12.061 +================================================================================
--- a/src/admw_1001.c Wed Feb 19 10:08:13 2020 +0000
+++ b/src/admw_1001.c Mon Feb 24 07:04:35 2020 +0000
@@ -52,7 +52,7 @@
#include "admw1001/ADMW1001_REGISTERS.h"
#include "admw1001/admw1001_lut_data.h"
#include "admw1001/admw1001_host_comms.h"
-
+#include "inc/mbedVersion.h"
#include "crc16.h"
#define VERSIONID_MAJOR 2
#define VERSIONID_MINOR 0
@@ -405,6 +405,11 @@
}
return ADMW_SUCCESS;
}
+ADMW_RESULT admw_readMbedVersion()
+{
+ ADMW_LOG_INFO("Mbed Firmware version is %X.%X.%X",MBED_HOST_MAJOR,MBED_HOST_MINOR,MBED_HOST_BUILD);
+}
+
static ADMW_RESULT executeCommand(
ADMW_DEVICE_HANDLE const hDevice,
ADMW_CORE_Command_Special_Command const command,
@@ -1262,14 +1267,11 @@
else
diagnosticsControlReg.Diag_Meas_En = 1;
- if(pDiagnosticsConfig->osdFrequency <= 0x7F)
- {
- diagnosticsControlReg.Diag_OSD_Freq = pDiagnosticsConfig->osdFrequency;
- }
- else
- {
+ if(pDiagnosticsConfig->osdFrequency <= 0x7F) {
+ diagnosticsControlReg.Diag_OSD_Freq = pDiagnosticsConfig->osdFrequency;
+ } else {
ADMW_LOG_ERROR("Invalid open-sensor diagnostic frequency %d specified",
- pDiagnosticsConfig->osdFrequency);
+ pDiagnosticsConfig->osdFrequency);
return ADMW_INVALID_PARAM;
}
WRITE_REG_U8(hDevice, diagnosticsControlReg.VALUE8, CORE_DIAGNOSTICS_CONTROL);
@@ -2438,66 +2440,59 @@
unsigned actualLength = 0;
- if (pLutData->header.signature != ADMW_LUT_SIGNATURE)
- {
+ if (pLutData->header.signature != ADMW_LUT_SIGNATURE) {
ADMW_LOG_ERROR("LUT signature incorrect (expected 0x%X, actual 0x%X)",
- ADMW_LUT_SIGNATURE, pLutHeader->signature);
+ ADMW_LUT_SIGNATURE, pLutHeader->signature);
return ADMW_INVALID_SIGNATURE;
}
if ((pLutData->tables->descriptor.geometry!= ADMW1001_LUT_GEOMETRY_NES_1D) &&
- (pLutData->tables->data.lut1dNes.nElements > MAX_LUT_NUM_ENTRIES))
- {
+ (pLutData->tables->data.lut1dNes.nElements > MAX_LUT_NUM_ENTRIES)) {
return ADMW_INVALID_PARAM;
}
-
- for (unsigned i = 0; i < pLutHeader->numTables; i++)
- {
+
+ for (unsigned i = 0; i < pLutHeader->numTables; i++) {
ADMW1001_LUT_DESCRIPTOR *pDesc = &pLutTable->descriptor;
ADMW1001_LUT_TABLE_DATA *pData = &pLutTable->data;
unsigned short calculatedCrc;
- switch (pDesc->geometry)
- {
- case ADMW1001_LUT_GEOMETRY_COEFFS:
- switch (pDesc->equation)
- {
- case ADMW1001_LUT_EQUATION_POLYN:
- case ADMW1001_LUT_EQUATION_POLYNEXP:
- case ADMW1001_LUT_EQUATION_QUADRATIC:
- case ADMW1001_LUT_EQUATION_STEINHART:
- case ADMW1001_LUT_EQUATION_LOGARITHMIC:
- case ADMW1001_LUT_EQUATION_BIVARIATE_POLYN:
+ switch (pDesc->geometry) {
+ case ADMW1001_LUT_GEOMETRY_COEFFS:
+ switch (pDesc->equation) {
+ case ADMW1001_LUT_EQUATION_POLYN:
+ case ADMW1001_LUT_EQUATION_POLYNEXP:
+ case ADMW1001_LUT_EQUATION_QUADRATIC:
+ case ADMW1001_LUT_EQUATION_STEINHART:
+ case ADMW1001_LUT_EQUATION_LOGARITHMIC:
+ case ADMW1001_LUT_EQUATION_BIVARIATE_POLYN:
+ break;
+ default:
+ ADMW_LOG_ERROR("Invalid equation %u specified for LUT table %u",
+ pDesc->equation, i);
+ return ADMW_INVALID_PARAM;
+ }
break;
- default:
- ADMW_LOG_ERROR("Invalid equation %u specified for LUT table %u",
- pDesc->equation, i);
- return ADMW_INVALID_PARAM;
- }
- break;
- case ADMW1001_LUT_GEOMETRY_NES_1D:
- break;
- default:
- ADMW_LOG_ERROR("Invalid geometry %u specified for LUT table %u",
- pDesc->geometry, i);
- return ADMW_INVALID_PARAM;
+ case ADMW1001_LUT_GEOMETRY_NES_1D:
+ break;
+ default:
+ ADMW_LOG_ERROR("Invalid geometry %u specified for LUT table %u",
+ pDesc->geometry, i);
+ return ADMW_INVALID_PARAM;
}
- switch (pDesc->dataType)
- {
- case ADMW1001_LUT_DATA_TYPE_FLOAT32:
- case ADMW1001_LUT_DATA_TYPE_FLOAT64:
- break;
- default:
- ADMW_LOG_ERROR("Invalid vector format %u specified for LUT table %u",
- pDesc->dataType, i);
- return ADMW_INVALID_PARAM;
+ switch (pDesc->dataType) {
+ case ADMW1001_LUT_DATA_TYPE_FLOAT32:
+ case ADMW1001_LUT_DATA_TYPE_FLOAT64:
+ break;
+ default:
+ ADMW_LOG_ERROR("Invalid vector format %u specified for LUT table %u",
+ pDesc->dataType, i);
+ return ADMW_INVALID_PARAM;
}
calculatedCrc = admw_crc16_ccitt(pData, pDesc->length);
- if (calculatedCrc != pDesc->crc16)
- {
+ if (calculatedCrc != pDesc->crc16) {
ADMW_LOG_ERROR("CRC validation failed on LUT table %u (expected 0x%04X, actual 0x%04X)",
- i, pDesc->crc16, calculatedCrc);
+ i, pDesc->crc16, calculatedCrc);
return ADMW_CRC_ERROR;
}
@@ -2507,17 +2502,15 @@
pLutTable = (ADMW1001_LUT_TABLE *)((uint8_t *)pLutTable + sizeof(*pDesc) + pDesc->length);
}
- if (actualLength != pLutHeader->totalLength)
- {
+ if (actualLength != pLutHeader->totalLength) {
ADMW_LOG_ERROR("LUT table length mismatch (expected %u, actual %u)",
- pLutHeader->totalLength, actualLength);
+ pLutHeader->totalLength, actualLength);
return ADMW_WRONG_SIZE;
}
- if (sizeof(*pLutHeader) + pLutHeader->totalLength > ADMW_LUT_MAX_SIZE)
- {
+ if (sizeof(*pLutHeader) + pLutHeader->totalLength > ADMW_LUT_MAX_SIZE) {
ADMW_LOG_ERROR("Maximum LUT table length (%u bytes) exceeded",
- ADMW_LUT_MAX_SIZE);
+ ADMW_LUT_MAX_SIZE);
return ADMW_WRONG_SIZE;
}