Comments (3)
Hi, thank you for your enhancement idea!
Can you explain to me more, what data you intend to store in the external database? I have the impression, you want to replace the object dictionary with an external database. This is really difficult, because the read and write activities triggers at some object entries actions (these are managed with the CO_TYPE functions).
The NVM drivers are responsible for saving the current value of a collection of object entries from the dynamic runtime area (RAM) into a persistent area (FLASH, EEPROM, or anything other). These values are used as start values after a restart of the node. If you consider an external database for this kind of persistent storage we could use the argument start
in the NVM interface as a selector for the given collection of object entries:
Let's try to brainstorm this kind of use-case:
Assuming you have two parameter groups. One with data for the NMT heartbeat configuration and another for the ADC calibration values:
struct NMT_PARA_T {
uint16_t Obj_1017_0_Heartbeat;
} NmtParaMem;
struct ADC_PARA_T {
uint8_t Obj_2100_0_AdcFactor;
uint8_t Obj_2100_1_AdcOffset;
} AdcParaMem;
Then we prepare the configuration for save, restore and reset behavior, factory settings, and the offset
(typical placement in non-volatile memory - for us we could use this as the identifier of the collection queries.
const CO_PARA {
0L, /* query-id for this parameter group */
sizeof(NmtParaMem),
&NmtParaMem,
:
} NmtParaObj;
const CO_PARA {
1L, /* query-id for this parameter group */
sizeof(AdcParaMem),
&AdcParaMem,
:
} AdcParaObj;
Note: these parameter group configurations are placed in the object entries 1010h and 1011h.
Now, instead of placing the NvmParaMem
and AdcParaMem
with the NVM drivers somewhere in NVM memory, we could store the contained object entries in an external database. First, we need to manage the queries for each entry in the parameter groups:
/* structures to support the query management: */
typedef struct PARA_QUERY_T { /* data for a single query */
uint16_t Index; /* all data we need to access database */
uint8_t Subindex;
uint8_t Size;
} PARA_QUERY;
typedef struct PG_QUERY_T { /* structure for a collection of queries */
PARA_QUERY *Query; /* start of para query array */
uint8_t Length; /* number of para queries */
} PG_QUERY;
/* definition of queries (I would place them near the parameter group definitions): */
PARA_QUERY NmtQueries[1] = {
{ 0x1017, 0x00, 0x2 } /* heartbeat (word) */
};
PARA_QUERY AdcQueries[2] = {
{ 0x2100, 0x00, 0x1 }, /* adc factor (byte) */
{ 0x2100, 0x01, 0x1 } /* adc offset (byte) */
};
PG_QUERY PgDb[2] = {
{ NmtQueries, 1 },
{ AdcQueries, 2 }
};
With the definitions in place, we can prepare the NVM driver for the external database (here only write as an idea):
uint32_t DrvNvmWrite (uint32_t start, uint8_t *buffer, uint32_t size)
{
uint8_t idx;
uint8_t *value = buffer;
uint8_t bytes = 0;
/* loop through addressed query collection and perform database action */
for (idx = 0; idx < PgDb[start].Len; idx++) {
pq = PgDb[start].Queries[idx];
/* place your database query here, e.g.: */
ExtDatabaseQuery (pq->Index, pq->Subindex, value, pq->Length);
/* navigate to next value in parameter memory */
value += pq->Length;
/* count all processed bytes */
bytes += pq->Length;
}
return (bytes);
}
!! Note: this is only typed in this issue - never compiled nor tested. I never did this in a real project. It is just the try to investigate, how we can achieve your use-case !!
from canopen-stack.
I have the impression, you want to replace the object dictionary with an external database
Exactly!
First of all, thanks for your answer: I've just started to use the stack, so I'm still in "learning" phase. I will answer to your in detail next week!
from canopen-stack.
Closed due to inactivity, the question is answered.
from canopen-stack.
Related Issues (20)
- website is moved to separate repository
- generate source package with release v4.4.0
- quickstart is moved to own repository
- Not able to find object dictionary file in the stack and no idea which tool need to use to generate the EDS file HOT 4
- Implementation on TI C2000 MCU with 16-bit bytes HOT 6
- Variable Block Download block sizes HOT 3
- Failed to link files HOT 2
- DSP: Integer16 is not read as expected HOT 7
- reentering an abandoned segmented SDO session
- protocol boot-up spec possibly followed incorrectly HOT 1
- EMCY Service Err Index Size
- Bugfix for COSDO Segmented Download
- Size of buffer during NVM read
- Problems with RPDO dummy mapping - potential array out of bounds write HOT 2
- Linux port of the stack HOT 1
- COTPdoMapWrite: Add error checking to prevent uninitialized variable access.
- SDO timeout message after SDO request was successful
- How to tailor the lib to run on small-size MCU
- COTmrService stops all timers on failed CO_IF_CAN_DRV.Send?
- CAN communication stopped after creating CANOpen node.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from canopen-stack.