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.

MSP430FR50431: MSP430FR50431

Part Number: MSP430FR50431
Other Parts Discussed in Thread: MSP430FR6041, MSP430WARE, MSP430FR6043, MSP430FR5043, MSP430FR5041

hi there.

i want to configure the MSP430FR5043I for I2C slave mode. i am working with the following TI examples: MSP430FR6043EVM_USS_Water_Demo and FR6043_USSSWLib_template_example

kindly provide sample code which configures the MCU for I2C slave.

following configuration of the MCU to I2C slave mode, i want to read a register from the master. Which register should i read, and what is the address of the configured i2C slave.

thanks in advance.

  • Hi Ephraim,

    Please see the TI resource explorer for example codes, including I2C peripheral mode for the MSP430FR50431. This example is a standalone I2C peripheral, not integrated with USS. You will be able to use this example to adjust your code to contain USS and I2C peripheral functionality.

    You can also find examples in the MSP430 SDK by looking in the [SDK install path]->driverlib->examples folder, and selecting your device family, or by going to [SDK Install Path]->examples-> devices, then selecting your device type, then your device family, then browsing the C folder.

  • hi Dylan, 

    for slave mode, do i set my own address?  UCB0I2COA0 = 0x48 | UCOAEN;             // own address is 0x48 + enable

    thanks,

  • Hi Ephraim,

    Yes you set your own address using that line. The UCB0I2COAx registers are all for setting and enabling your own I2C address as a peripheral device. Please see the Family User's Guide section 32.4 for more information about each register for the I2C module.

  • hi Dylan and thank you so much.

    now i have some questions regarding TI's examples: FR6043_USSSWLib_template_example and MSP430FR6043EVM_USS_Water_Demo.

    i will use one of these as a starting point for code that i will develop. i will need to take the data received from the water sensor, and stored it into the I2C data buffer, send interrupt to the master I2C, so it can begin reading the data.

    which one of the these given examples is more suited to begin writing code? i also noticed that both examples contain I2C, is there documentation explaining what the I2C is used for in these demos? Since both these examples use external PC GUI through the USB.

    thanks,

  • I would recommend that you utilize the template example as your primary resource for writing the code. I will note that this example is not intended for use with the PC GUI through USB. If you require the PC GUI, then you will need to use the water demo code. The template example also does not already include I2C functionality. However it is the version that we intend for customers to use in production and to add things like communication protocols to.

    For editing either of these examples, you need to be mindful of when interrupts are occurring, as unexpected interrupts seem to result in the algorithm not working, in my experience. When I added I2C functionality to the template example, I had to disable all other interrupts while performing sends and receives as an I2C controller, then re-enable them once complete. 

    As for documentation, you should look at the "Technical Documentation" section of the MSP430FR50431 Product Page, and the same section of the MSP430FR60431 Product Page, as these are the same device besides the LCD functionality. On both of those pages you will find many documents that explain USS, the device, and use cases.

  • Hi Dylan,

    kindly direct me in the code for the FR6043_USSSWLib_template_example and MSP430FR6043EVM_USS_Water_Demo. where i can read / write and reinitialize the sensor with new values.  Also, which variable is used to read the data, from the sensor ADC? 

    USS_GAIN_RANGE

    USS_ADC_SAMP_COUNT_SEC

    USS_START_CAPTURE_SEC

    USS_TURN_ON_ADC_COUNT_SEC

    USS_NUM_OF_EXCITATION_PULSES_F1

    USS_ALG_RATIO_OF_TRACK_LOBE

    thank you in advance. have a good weekend.

    Barry

  • It is unclear what you mean when you say read/write/initialize the sensor with new values. When you say the sensor, do you mean the transducers? The initialization and excitation of the transducers is performed by the example project, if you would like to see the code for how this is done, I would encourage you to step through the code to see the device initialization. 

    The template example project also already performs the ADC readings for you, and performs all calculations based on that, so it is not necessary for you to manually read the ADC data. If you decide that you do need to do so in your application, I encourage you to look at the ADC examples that are found in the SDK at the path below. It looks like we offer 8 register level ADC examples there:

    [SDK Install Path] \msp430ware_3_80_14_01\examples\devices\MSP430FR5xx_6xx\MSP430FR6043_MSP430FR6041_MSP430FR5043_MSP430FR5041_Code_Examples\C

    For an ADC example that uses driverlib, please find the "adc12_b" project in the following path:

    [SDK Install Path]\msp430ware_3_80_14_01\driverlib\examples\MSP430FR5xx_6xx

    For explanations of each of the defines that you've listed above, and for ordinary ranges for those, please visit the USS Design Center Users Guide.

  • Hi Dylan, and thank you so much for your assistance, and patience.

    my first task is to modify the values of the parameters below during runtime based on initial signal received from the transducer. 

    USS_GAIN_RANGE
    USS_ADC_SAMP_COUNT_SEC
    USS_START_CAPTURE_SEC
    USS_TURN_ON_ADC_COUNT_SEC
    USS_NUM_OF_EXCITATION_PULSES_F1
    USS_ALG_RATIO_OF_TRACK_LOBE

    I need to locate the location where the signal from the transducer is received, after some tweaking of the above parameters, I need to re-initialize the transducer.

    i realize in the Demo using the USS gui, i can change these values.

    thanks,

**Attention** This is a public forum