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.

TMAG5170: Programming TMAG5170

Part Number: TMAG5170

Hi Team,

Can you please help us with our customer's inquiry below.

I program in SPI an exchange between a MSP430 and a TMAG5170, on code composer I have an error when I want to add the library tmag5170 and I would like to know how to do
I would like to retrieve the data from the TMAG sensor in the MSP430 and try to create a program for this
For the moment I took the example function given on the texas site but I get errors on code composer just with the #include <tmag5170>
There is also the TMAG registry, I found what I wanted but I don't know under which syntax I have to write it in the code
Indeed I use the functions of CODE_EXAMPLE and I found the solution for the problem of library it was necessary that I add the file tmag5170.h and also hal.h but it misses the file settings.h that I is not found
Moreover in the functions I have errors of which here are the photo of the lines and the report of error. I also join you my files.c if it can help you
 
Attached are the codes and screenshot of the error.
Regards,
Danilo
  • Danilo,

    The include statement for settings.h is located in the processor specific portion of the hal.h header.  If not required by Maxime's system, then it can be removed. It is not part of the listed files that are intended to be part of the example code download.  It is necessary to modify the HAL.h and HAL.c to match the requirements of the controller being used.  Instructions for this step are included in README.md

    The function for a standard read command as written in the code example is shown here:

    //****************************************************************************
    //! Register-only Read Function for Normal Data Mode (DATA_TYPE = 000b)
    //!
    //! Takes in address to read from and returns register at address without the status bits or
    //! triggering any CMD function (cmd_bits = 0x00).
    //!
    //! address   - uint8_t value from 0x00 to 0x14 containing the register address to read from
    //****************************************************************************
    uint16_t normalReadRegister( uint8_t address )
    {
        uint16_t output[2] = { 0 };
        normalRead( output, address, 0x00 );
        return output[0];
    }
    

    So, when calling this function we could read register 0x09 (X Channel Result) using:

    uint16_t OutputData = normalReadRegister(0x09)

  • Hello I have a lot of errors on this type of line in the hal.c code can you help me to tell me what it corresponds and how to correct it :

    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);

    MAP_GPIOPinTypeGPIOOutput(nCS_PORT, nCS_PIN);

    the error is : #20 identifer "CPIO-PIN_1" is undefined

  • Hello I have a lot of errors on this type of line in the hal.c code can you help me to tell me what it corresponds and how to correct it :

    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);

    MAP_GPIOPinTypeGPIOOutput(nCS_PORT, nCS_PIN);

    the error is : #20 identifer "CPIO-PIN_1" is undefined

  • Hello Maxime,

    Scott is currently out of the office due to holiday so I will be helping you out with your question. It was noted above that you are using an MSP430 for your implementation but the objects being referenced belong to an MSP432. As mentioned in bullet point #2 of the README.md file in the example code if you are using a different processor in your case an MSP430, you have to add the library reference for your specific MCU in the hal.h file.

    Once that is done, as point #3 mentions you will have to edit all of the function implementations inside of the hal_ex.c file. This is most likely why you are getting errors in your code, if you have updated the reference in the hal.h file but you have not updated the functions inside of the hal_ex.c file then some of the functions are trying to reference objects that are not available in the MSP430 or that may have different names.

    I hope this helps let me know if there are any questions remaining.

    Best,

    Isaac