LMS7002M MCU Source code

Hi everyone!

We would like to compile the source code for the LMS7002M MCU and generate its HEX file, as we would like to modify it slightly in order to add a DC offset calibration.

Could you please point us to the source code of the LMS7002M MCU and compilation instructions?
We plan on using an MDK that does not require a license, any suggestions towards that end are welcome.

Do you really need to run the calibration using LMS7002M MCU?
As it is now there is almost no resources left for additional code, so any modifications you would make might not fit into the available memory. Also there is no way to debug code running on the MCU. The only reason calibration is done using the MCU, is to avoid time overhead of USB communications.

I would highly suggest running the calibration directly from PC host, that way there would be no resources limit and easy to debug.

Hi @ricardas, thanks for your reply. We would like to simply add a new case in the main case statement. For example, in the following statement:

 //P1 returns MCU status
    while(1)
    {
        if(runProcedure)
        {
            switch(currentInstruction)
            {
            case 0:
                runProcedure = false;
                while(!hasStopped);

                P1 = MCU_IDLE;
                break;
            case 1: //CalibrateTx
                P1 = MCU_IDLE | CalibrateTx(false);
                break;
            case 2: //CalibrateRx
                P1 = MCU_IDLE | CalibrateRx(false, false);
                break;

Although the CalibrateRx function provides the DC calibration only option, there’s no case statement for this option. So we would like to simply add the following three lines:

            case 19: //CalibrateRx DC only
                P1 = MCU_IDLE | CalibrateRx(false, true);
                break;

We prefer to do this on the MCU as we want to run this with minimum latency.

Any suggestions on how to compile the existing MCU code are welcome. As far as we have seen, we’ll need to do so using an SDCC compiler targeting 8051 MCUs, however our only option is to do so using a software that doesn’t require a license.

I’ve ported the existing code to be compilable with SDCC, unfortunately SDCC does not have as extensive optimization capabilities as Keil C51 compiler, so the SDCC generated program output size is 26KB, which exceeds the LMS7002M MCU memory of 16KB.

1 Like

Many thanks @ricardas for letting me know! I have managed to port the source code to SDCC compiler format as well but was getting error messages about this. Thought I was doing something wrong!

That makes sense, thanks!