Main Site Documentation

Changing hardware and detecting on startup? Possible?


#1

Hi there

I am considering to deploy a few mainboards with a few sensors in the field, but space and money limits the number of displays.

So I was considering to upload code to the mainboard with the T35 display attached and working, with debugging and status info - and then turn it off and remove the display.

When rebooting the machine, it should detect that the display is missing, and then just write status to the SD-card and not to the display.

And vice-versa, when plugging in the display again, and booting the machine, it should write to the display…

Is that possible at all?


#2

Why don’t put a config to the SD card to initialize the components during boot?


#3

@ David@ Emrol - Im not sure I understand what you mean…?

Im concerned what will happen when hardware is removed or mounted on the board, and then it boots with an unexpected configuration.

Isnt hardware libraries linked into the deployment operation?

Thanks.


#4

Not sure about the display driver, but Network for example is initialized in code. Even that the driver is there, if I do not initialize it it does not matter if it is connected or not.
To detect this you could use some setting from SD or may be an additional digital input which you set by ajumper for example.
It might also be possible to detect the display by reading an GPIO before initializing the display.
You also might read a analog in pin from touchinterface if your display has one.
May be by adding a parallel pull up or down to it allows you the see if it is connected when the analog touch input is not pulled to it’s maximum value.
I can not tell you if this works for sure. It’s just a couble of suggestions you could try.

But I don’t think you will damage anything by having your display disconnected. So why don’t you give it a try?


#5

I often use a file on SD card that i read during boot and use the data to determine what elements have to initialized or not.
Based on the data in the config you can use some flags in your program and skip some pieces of code, or handle things different.

for example:

config.ini with some lines like

DISPLAY=TE35 or DISPLAY=NONE
NETWORK=WIFI / ETHERNET / NONE

etc.

And in your main program execute code depending the values you have read from the config file.

In general if it’s only a display the you can just leave it out and your program will run just fine.