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.

CCS/MSP430FR2532: Capacitance Touch

Part Number: MSP430FR2532

Tool/software: Code Composer Studio

Hi, 

I am trying to write a program to measure capacitance from one of the pin of  MSP430FR2532. (Like P2.3 (CAP0.2), Single pin, self-capacitance measurement)

CapTivate library is really easy to use and I could figure out how to generate the code using the CapTivate Design Center to do the measurements and it works fine. 

However, I have other sensors which should work with a capacitance sensor at the same time. I could also combine the codes together but it stops working after 30 s or one min of working. I think it is because of my limited understanding of CapTivate software.  

Do you have an example code for self-capacitance measurement which does not use the CapTivate Library? Measurement of the C-charge is enough in my application (Base count - Measured Count). 

Thanks, 

Aref 

  • Hi Aref,
    if I understand you right, you have created two projects/code examples, one which was implementing the measurement just on one pin and then the other one, where additional measurements are being performed. Combining them manually resulted in the malfunction, you're indicating. Is this correct?
    In any case, I would recommend you to use the CapTivate Design Center GUI, to generate the complete portion of the capacitive sensing code, even if it is for multiple electrodes, instead of trying to combine multiple projects manually. The process would require extensive and deep understanding of the CapTIvate logic, that's why we're not supporting also working without the library. It is much easier to use the CapTIvate Design Center, which avoids automatically potential issues.

    Best regards
    Peter
  • Peter,

    Thanks so much for your response.

    Correct, I combined them manually based on the steps mentioned here:

    software-dl.ti.com/.../ch_library.html


    Basically, I have a code example for two pressure sensors which work perfectly (using I2C). I need to add a self- capacitance electrode to the project. I added the Pressures code example to the generated self-Capacitance code manually. But there is an issue which I can not figure out what is that. The program works fine for 1 or 2 min and then stops working (maybe because of some defined interrupts in the captivate library).

    If you are not supporting working without the library, would you please guide me what are the steps I should take to combine the programs together if there is a way?

    Thanks,
    Aref
  • Aref,
    most probably, as created independently, there are some conflicting settings for the separately created projects. I think it would be too time consuming trying to figure out manually all the locations, where there might be conflicts, resulting in the observed behavior. My recommendation would be to go once again into the CapTIvate design center and create a new project, where you setup already from the beginning the CapTIvate module for the FR2532, as you want it to be means connecting the pressure sensors and the additional electrode. Doing so, the GUI will automatically take care of avoiding the conflict, if it's not caused by your higher level code, which you already integrated. If there should be some not solvable conflicts, it will not let you generating the code.
    This way you can pretty quickly test, whether it's the configuration conflicts from CapTIvate, or some higher level application code creating the issues.

    Best regards
    Peter
  • Thank you so much. I will try it.
    But when I start a new project in CapTIvate Design center, how should I connect the pressure sensor code to the project ?

    Thanks
    Aref
  • Hi Aref,
    I assume, when you're speaking about the pressure sensor code, you're talking about the higher level functions and code portions, which you have added to the originally generated code from the CDC, correct?
    If this is the case, I would still create a new project as described previously. Before adding your code portions, I would test the code as exported from the CDC. I assume this should work properly, without stopping after a while, as with your current one. So this test will be mainly for reference, and double checking.
    In the code from the CDC, for the pressure sensors, there should not be a difference, if you set them up as before. So the main difference will be the additional touch sensor/s, but the advantage will be, that the CDC takes care of the co-existence.
    If you later on, after adding your higher level code, should still experience issues, this would indicate that the root cause is in your portion of the code, means the conflicts are created by this portion. This could be e.g. stopping the clock source, used by the CapTIvate Timer, or overwriting some other settings.
    Then I would integrate the functions you have added. It is a good practice to create your own source files for this code. This has the advantage of minimum modifications in the source files generated from the CDC. So in case of need for changes on the CapTIvate code at a later point, you can easily update the entire project.
    I hope this helps better to understand the procedure.

    Best regards
    Peter
  • Yes, I have my own defined functions and code portions, which I have added to the originally generated code from the CDC. I still have the issue. So I decided to tell you the steps I have taken. Please take a look and let me know if I am missing something. Here are the steps:

     1- Defining the sensor and MCU: (picture  1)

    2- Sensor Configuration (only one self capacitance, Picture 2, P2.3, Cap0.2)

    3- MCU configuration (Picture 3)

    3- Auto assign and generate code ( CODE works perfectly at this step)

    4- Adding my own defined functions and code portions to the generated code from the CDC. (Code does not work)

    In other words, I have two codes:

    1- Generated code from the CDC (for one self capacitance measurement)

    2- My Pressure sensor code which communicate through I2C and it is connected to P1.2 and P1.3 (SDA and SCL channels)

    I want to combine them and make a single code. 

  • Hi Aref,
    many thanks for the listing of the steps you're performing. It clearly indicates, that the step 4, means adding your own functions and code portions breaks the code.
    This means you have to debug this step in very detail, means adding function by function, change after change to the original working code and test, whether the updated project still works. Once you have hit the point, where the project breaks and stops working, you have the responsible function/change.
    As soon as you have identified this, you'll see the root cause. If you you have difficulties to understand what's happening at that stage, please come back to me. Many thanks in advance.

    Best regards
    Peter
  • Hi Aref,
    under the assumption you do no longer need support on this. In case this should not be the case, please reopen the thread, or start a new one on the specific problem, you're currently at.

    Best regards
    Peter
  • Thanks Peter for your help.

**Attention** This is a public forum