Main Site Documentation

Panda II Advice on storing/retrieving configuration maps


#1

My project is to be an I/O device based around the Panda II, and will use a Wiz500 controlled ethernet port to communicate to a TCP server (not my own software) in a local network. At the current stage, I am able to pass switch input to the TCP server, and accept data from the server to drive displays. The project would be simple if the mapping of server data values to outputs (and switch inputs to server data values) was fixed - I would just code it as some sort of glorified lookup table. Unfortunately, my end user community is looking for a more generic implementation, where they can configure the mappings - up front, and periodically as needed.

For a similar project where the software was PC-based, I stored the mappings in XML files and loaded them at runtime, and provided an editor and a way to save updated info into the XML files.

I’m looking for advice on the best approach to take on the embedded device level. My application will need to be able to store and retrieve the equivalent of three 32-element arrays of short strings (~ 10 characters on average) For example:

The device interfaces with an I2C port extender to monitor 32 switches. When a switch is pressed, the device will have to use the address of the switch to look up a string variable code, and send that code to the TCP server. The codes for each switch port must be user configurable, persistent, and loaded at run-time. Similarly, upon reception of a string code from the server, the device will look up that string and illuminate an LED on one of the 32 ports (on a display driver) stored as the value mapped to that string.

Using an SD card seems like overkill, and adds to the expense of the product. Is there an onboard solution? EEPROM? Is there a code-friendly way to implement this without complex serialization functions, token parsing, etc? That stuff makes my head spin .

I’d appreciate any advice / input, including thoughts on how to implement the user input (thinking about via onboard web server, mini-config utility, etc). I’m also wrestling with the “chicken and egg” issue of how to enable the user to configure the devices via TCP given the variety of home network IP schemes. Initially hard-coding an IP and expecting user to reconfigure a PC to enable programming seems unfriendly. I’m guessing implementing a mini web server might be easiest way to configure at least the network settings.

Thanks!

Scott


#2

May be you can create an object to store the configuration values, serialize it and store it on InternalFlashStorage.

USBizi supports InternalFlashStorage of 4K size. If you are going to use this to store the configurationd data and not perform frequent writes, this may be a good option.

Here is the documentation for InternalFlashStorage

http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation/html/ccb0e435-a5e2-d315-9be4-b8de5a6fcc85.htm

Look at this example for serialization

http://wiki.tinyclr.com/index.php?title=Serialization

HTH.


#3

Thanks for the input, Rajesh. I guess I was hoping for a “magic” way to avoid serialization :wink:

The flash memory should be more than enough room. Since I’m dealing with string data and byte-sized numerical values, I should be able to come up with a scheme to serialize my values and their relationships without losing my mind.

-Scott


#4

@ petdocvmd - Have a look at these code examples, they may be of some help:

http://www.tinyclr.com/codeshare/entry/351

http://www.tinyclr.com/codeshare/entry/363


#5

I don’t wanna spoil the fun but keep this in mind: