Fiddling firmware



    1. I accidentally disabled a couple of GPY lte modems recently by setting cereg=0. It took an age but finally the penny dropped & I realised that in the GPY firmware lte.isattached() most probably uses the cereg unsolicited result code to tell if the modem is attached or not. Since I'd disabled cereg, lte.isattached() no longer worked.

    2. There are a number of other unsolicited result codes the monarch modem is capable of but to access them I guess a new function lte.breakout(name) would be needed to make them accessible?

    3. I know a few people on this forum have modified standard pycom firmware & I was wondering if the firmware is in C++ or python, just how opaque it is & how difficult it might be to add extra functionality for accessing other monarch unsolicited result codes?



  • @kjm The firmware is mostly C, with a dusting of a variety of other things (C++, Assembly, Python).

    The initial setup is (or at least was) a little finicky, you need to have the right versions of ESP-IDF, cross-compiler, etc. Read the docs, most of it is actually well documented. Once it's all set up, it's really quite easy to make changes and recompile if it comes to just changing the behaviour of existing functions. I've never tried adding new Python functions in the firmware, though I suppose this shouldn't be too hard.

    The only tricky part is when the code you're interested in is in an interrupt handler, you need to take special care, you can't just do anything you want in those, so you sometimes have to defer some stuff from the interrupt handler to the "main" code.

    IIRC, there are already lots of facilities in the code to trace all that is exchanged with the modem, it's just a matter of enabling those, so you may not even have to write any code, if you're just interested in seeing (i.e. dumping on the console) the relevant info rather being able to process it in your own code.


Log in to reply
 

Pycom on Twitter