This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OPT3101EVM: Stock EVM firmware and SDK calibration

Part Number: OPT3101EVM
Other Parts Discussed in Thread: OPT3101, MSP430F5529,

Hello, 

I'm currently evaluating the OPT3101 using the EVM. I have been able to get up and running with the Latte out of the box demo without issue. I'm now proceeding to deeper evaluation. One of the main things I need to do is test with wider FoV optics, I know however that this will require re-calibration of the EVM. Additionally I know from my reading the documentation that this needs to be done via the SDK. I have a few questions regarding this process.

A disclaimer on my skill level with TI MCUs -  I'm new to TI MCUs in general, but have a lot of experience with embedded MCUs from other manufactures. 

1. Before I proceed to load any new firmware on the EVM or do a calibration, I would like to read our the current firmware and calibration coefficients from the EVM and save them off so that I can revert if needed during testing. This step is even recommended by the EVM user guide, but I have yet to find a procedure for doing this.  

Must this be done via a SWD/JTAG prob? Or can this be done via the bootloader re-loaded on the MSP430?

2. In order to do the calibration, the SDK seems to reference the use of a MSP430F5529 launch pad. Is it required to use the launch pad? or is there a way to perform the calibration using the on board MSP430 on the EVM? If it is possible to do the calibration via on the on board MSP430 is there any documentation to show how this process is done?  

Thanks,

Eric

  • Hi Eric,

    I will need some time to think over this. I will give you a reply by tomorrow.

    Thank you,

    Brent Elliott

  • Hi Eric,

    You can bypass the onboard MSP430 with the launchpad so that you will not have to wipe the calibration of the onboard MSP430. You will need to have both the launchpad and the EVM plugged in through USB, and wire up P4.1 on the launchpad to I2C Data on the EVM, P4.2 on the launchpad to I2C Clock on the EVM, and connect the grounds of the EVM and the launchpad.

    Thank you,

    Brent Elliott

  • Brent,

    Thanks for the reply. I have a few follow up questions:

    1. Won't having both the launchpad and on board MSP430 both on the same I2C bus with active firmware cause issues? This puts two I2C masters on the same bus with no coordination trying to access the same slave and it's registers. Does the EVM MSP430 need to be held in reset while using the SDK and launchpad?

    2. If I do use the launchpad and SDK to do a calibration, how do I translate this calibration over to the EVM MSP430? Can this be done via Latte? It seems Latte has a folder for calibration data built in, It's just unclear how to use this. 

    3. Additionally I still would like to preserve the original calibration coefficients so that I can revert if needed during testing.  How is this done? 

    My ultimate goal is to update the optics on the EVM, perform a calibration, and then test using EVM USB connection and Latte for data collection. 

    Thanks,

    Eric

  • Hi Eric,

    1. Let me reconfirm this. I have had this question before and this method worked for me but I understand what you mean so I will retest and let you know.

    2. You will need to use the SDK. The SDK user's guide details how to implement the calibration coefficients that you obtain so that you can test using the SDK after calibration.

    3. Are you able to read out the registers of the device in Latte using the command "dev.readRed(addr)"? If so, you can save the calibration coeffs this way.

    Thank you,

    Brent Elliott

  • 1. Thanks for checking on this.

    2. Understood, I will look into the SDK documentation. If you happen to know where to look in the doc mention to specifically implement the cal coefficients on the EVM MSP430 please point me in the right direction. 

    3. Yes I think I am able to read out all the cal registers using Latte, using the following code (from another post on this forum):

    calibrationRegisters=np.array([0x0B,0x0C,0x29,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x38,0x39,0x3A,0x41,0x42,0x43,0x45,0x47,0x48,0x49,
    #--External Temp Sensor Coeffs (TX0,TX1)--
    #0x30,0x2D,0x2F,0x41,
    #0x46, #TEMP_COEFF_ILLUM_HDR0_TX0
    #0x47, #TILLUM_CALIB_HDR0_TX0
    #0x48, #TILLUM_CALIB_HDR1_TX0
    #0x49, #TILLUM_CALIB_HDR0_TX1
    0x51, 0x52, #TEMP_COEFF_ILLUM_HDR1_TX0
    0x53, #TEMP_COEFF_ILLUM_HDR0_TX1
    #0x54, #TEMP_COEFF_ILLUM_HDR0_TX1
    #0x55,0x56, #TEMP_COEFF_ILLUM_HDR1_TX1
    0x5E,0x5F,0x60,0x71,0xB4,0xB5,0xB8,0xB9],dtype=np.uint8)
    
    log('Cal Registers:')
    for regAddr in calibrationRegisters:
    	data=dev.readReg(regAddr)
    	log('0x%02X 0x%06X'%(regAddr,data))

    Thanks,

    Eric Goodchild

  • Hi Eric,

    Regarding question 1, this will work since the EVM MSP will not be holding the bus since it will not receive any commands to communicate via I2C. I hope this answers your question. If so, you can click "this resolved my issue".

    Thank you,

    Brent Elliott

  • Brent,

    That resolves part of my question. I still need to know where to find documentation on how to load the cal coefficients onto the EVM. I have looked through:

    "OPT3101 SDK Users Guide" and "How to set up and calibrate OPT3101 based systems for proximity sensing" I both docs provide good info on how to generate the coefficients, but not how to get them onto the OPT3101EVM. 

    Can you please point me to any documentations that shows me how to load the EVM MSP430 with new coeffects? Can this be done via Latte? 

    Thanks,

    Eric

  • Hi Eric,

    Sorry about that. I sent the reply out before I refreshed the page and saw your other message. The SDK Users Guide has instructions on how to implement the cal coefficients into OPT3101Coefficients.cpp, which is used to load the coeffs onto the EVM. It also has details on the procedure itself.

    You will want to keep the current calibration on the onboard MSP and then load the new coefficients on the launchpad's MSP.

    Thank you,

    Brent Elliott

  • Brent,

    Thanks I will give this a try over the next few days. If I get it up and running I will close out the thread. Thanks for all the help so far. 

    Want to keep the thread open until then in case there are any additional related questions.

    Thank you,

    Eric

  • Ok, we will wait on your confirmation then.

    Thank you,

    Brent Elliott

  • Okay so I have managed to get calibration up and working with the MSP430 launchpad. From what I understand so far there are differing levels of calibration, at a minimum it seems that Illuminated crosstalk and phase offset calibration are required for a new design. It seems these steps get performed when running INLAB_STEP_1 in the SDK. 

    After performing this step on a stock OPT3101EVM I do not seem to get valid distance results after calibration in the live view. So I have a few additional questions to help assist in debug.

    First some extra info on my calibration setup and SDK configuration:

    Calibration Setup

    Calibration distances of 150mm and 500mm.

    SDK Configuration

    main.cpp

    #define INLAB_STEP_1 //simple bring up

    OPT3101_configurations.cpp

    Using generated file from configuration tool. I had to make a lot of assumptions here because I don't have a configuration file for the stock OPT3101EVM.  

    Questions:

    1. Assuming a non changing ambient temperature and ambient light conditions, is Illuminated crosstalk and phase offset calibration only sufficient for basic testing?

    2. After performing calibration "dev.resetInitAndViewData(3000, true);" is called. This function seems to reset the device. Won't this clear the coefficients that I just wrote into the OPT3101 during the calibration? 

    3. Can you provide a the OPT3101_configurations.cpp for the OPT3101EVM? I would like to compare it to the one I generated.

    4. Any other suggests for debugging?  

  • Hi Eric,

    1. You can use just the crosstalk and phase offset calibration for evaluation and testing.

    2. The second argument in resetInitAndViewData enables load calibration, which will set the calibration registers of the device from a file which is referenced in the loadIllumCrosstalkSet and loadPhaseOffsetSet methods.

    3. The SDK comes with an example if you wish to have a reference.

    4. Please read through the resources that we have on calibration, I'll link them below.

    https://www.ti.com/lit/ug/sbau310/sbau310.pdf?ts=1656626369390&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FOPT3101

    https://www.ti.com/lit/ug/slau791/slau791.pdf?ts=1656626383587&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FOPT3101

    Also check out the SDK user's guide as it provides more info on calibration.

    Thank you,

    Brent Elliott

  • Brent,

    1. Thanks for confirming this was my understanding as well from reading the documentation. 

    2. Yes I understand that the resetInitAndViewData has the bool load Calibration parameter set to true. My question related to the coefficients that are loaded.  It seems that these methods are pulling the hardcoded coefficient from "OPT3101Coefficients.cpp". So what I was looking to confirm was that after the calibration step is performed and resetInitAndViewData is called, the calibration I just did would NOT be loaded into the device, rather the hard coded values will be loaded. So in order for the calibration to have any effect I would need to save the coefficients from the cal process hardcode them into "OPT3101Coefficients.cpp", recompile and reload the launchpad before I would see any effect in the live view. The SDK documentation is vague in this respect and doesn't mention any of the above steps.

    3. Yes the SDK comes with an example "OPT3101_configurations.cpp" however this doesn't seem to be for the OPT3101EVM. I'm specifically looking for a OPT3101_configurations.cpp that is for the EVM. I would like to confirm that the configuration I'm generating has reasonable settings for the EVM.

    4. I have already read through this documentation although it has good general information on the math and correct register calibration process, it lacks specifics on how to get up and running with the SDK.  The SDK documentation has these specifics but is missing a lot of details and steps that must be interpreted (like the details mentioned in questions 2 above).  

    I will attempt to do another calibration today by hard coding the values into OPT3101Coefficients.cpp after calibration. It would be great if you could provide the following:

    OPT3101Coefficients.cpp - specific for the OPT3101EVM

     OPT3101_configuration.cpp - specifically for the OPT3101EVM

    Having the two above files would go a long way, because as I work my way through this process I can reference these two files to make sure the values being generated are reasonable. I would also recommend adding these files to SDK. I see a lot of people on this forum this very similar questions and having a configuration for the SDK by default that was for the EVM would make a lot of sense as this is the board everyone starts with when they begin to evaluate the OPT3101 and SDK. The SDK as it is now seems to be configured for some other OPT3101 design and it's unclear what design. This creates a lot of confusion for first time users of the SDK (such as myself).  

    Thanks,

    Eric Goodchild

  • For those out their that run into a similar problem that I did, here is the solution:

    When running "#define INLAB_STEP_1 //simple bringup" in the SDK in order for you calibration to take effect without having to hardcode coefficients into OPT3101Coefficients.cpp and recompiling, use the following in main.cpp:

    #ifdef INLAB_STEP_0
        dev.resetInitAndViewData(3000, false);
    #endif
    #ifdef INLAB_STEP_1
    	dev.calibrationSession_firstTimeBringUp();
    	//dev.resetInitAndViewData(3000, true);
    	dev.liveDataView(3000, 100, false);
    #endif
     

    The SDK by default calls dev.resetInitAndViewData(3000, true); after performing the calibration dev.calibrationSession_firstTimeBringUp(); This function resets the device clearing the calibration you just performed and then loading the hardcoded coefficients in OPT3101Coefficients.cpp. 

    Rather I added dev.liveDataView(3000, 100, false);. This function initiates live view without resetting the device so you can see the results of your calibration without the hassle/confution mentioned above. 

    Brent,

    I would still like the below files as mentioned for reference as I attempt to perform the more complex calibration steps. 

    OPT3101Coefficients.cpp - specific for the OPT3101EVM

    OPT3101_configuration.cpp - specifically for the OPT3101EVM

    Thanks,

    Eric

  • Hi Eric,

    Thanks for the reply. I cannot provide the Coefficients.cpp file since each EVM is calibrated individually and will have different coefficients. You can however read out the device calibration registers to find these values for your EVM in specific. I will look for a configuration.cpp file specific to OPT3101EVM and let you know on Thursday next week since I will be out of office until then.

    Thank you,

    Brent Elliott

  • Brent, 

    It would still be helpful to have a calibration file for any EVM model. Again I want want to use this as a sanity check to make sure that when I generate a new calibration that the new values are in the ball park. I don't plan to use the provided Coefficients.cpp as a calibration for my EVM directly. 

    Thanks for looking into the configuration.cpp file, that will be very helpful. 

    Thanks again,

    Eric

  • Hi Eric,

    Brent is out of office but should get back later this week.

    Best,

    Alex 

  • Hi Eric,

    I've looked into this and we do not have a coefficients or calibration file from the EVM that we can provide because the EVMs were not calibrated using the SDK. The configuration tool with super HDR enabled will get you a config file which will be very close to the same configuration as the single-channel EVM.

    Thank you,

    Brent Elliott