Other Parts Discussed in Thread: SYSCONFIG
Hi. I'm trying to implement an I2C slave device using CC1352P1. I would like to activate slave mode on this device.
I've been experimenting with i2ctmp_CC1352P1_LAUNCHXL_nortos_ticlang example code.
I'm having trouble accessing/changing registers.
I've come across these threads related to my implementation so far:
I'm trying to use interrupts to control data flow on the I2C bus. However, I can't seem to modify and see some register values. Here's a screenshot from the debug mode / registers:
I can't change or see what SCTL DA bit is. Datasheet specifies that this bit enables the I2C slave operation when set to 1.
Device specifications:
- SCL is on pin 16 and SDA is on pin 17.
- SCL and SDA lines are connected to the master's pins. These pins are pulled up to the master's 3V3 pin using ~6K ohm loads.
- Slave and master devices have common grounds.
- Master device can communicate with another device (STM32 to STM32 with interrupts). So I know master device sends requests to the address 0x3E.
Include Options of the project:

I would like to know:
- How to modify the SCTL register value.
- What MTPR alters. Does that affect slave operation? I cannot modify this register value.
- I keep seeing some garbage values when I activate master device on SDR register such as "9F", "3F", "FC" etc. periodically. Why is this not 0x05 or 101(0) instead? (refer to my code)
/*
* ======== main_nortos.c ========
*/
#include <stdint.h>
#include <stddef.h>
#include <NoRTOS.h>
#include <ti/drivers/Board.h>
#include <unistd.h>
/* Driver Header files */
#include <ti/drivers/GPIO.h>
/* Driver configuration */
#include "ti_drivers_config.h"
/* User includes */
#include "i2c_protocol.h"
#include "i2c_registers.h"
#include "D:/ccs/simplelink_cc13xx_cc26xx_sdk_6_41_00_17/source/ti/devices/cc13x2_cc26x2/driverlib/prcm.h"
extern uint8_t aTxBuffer[];
#define TASKSTACKSIZE 640
/*User function prototypes*/
void I2C_Slave_Command(void);
void Init_I2C_Slave(void);
/*
* ======== mainThread ========
*/
int mainThread(void )
{
/* Call driver init functions */
GPIO_init();
// HWREG(GPIO_BASE + 0x48) |= (1 << 0) | (1 << 8); // GPIO initialization example (it works!)
/* Configure the LED and if applicable, the TMP_EN pin */
GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
/*TRYING new implementation*/
return 0;
}
/*
* ======== main ========
*/
I2C_Params i2cParams;
I2C_Handle i2cHandle; // Declare handle for I2C module
int main(void)
{
Board_init();
/* Start NoRTOS */
NoRTOS_start();
Init_I2C_Slave();
/* Call mainThread function */
mainThread();
while (1) {
// Run continuously
}
}
void i2c_callback(void)
{
uint32_t status = I2CSlaveIntStatus(I2C0_BASE, true);
I2CSlaveIntClear(I2C0_BASE, status);
if(status & I2C_SLAVE_INT_DATA)
{
while( I2CSlaveStatus(I2C0_BASE) & I2C_SLAVE_ACT_TREQ)
{
I2CSlaveDataPut(I2C0_BASE, 0x05); // send stuff
GPIO_toggle(CONFIG_GPIO_LED_0);
}
}
}
void Init_I2C_Slave()
{
// Initialize I2C module
i2cHandle = I2C_open(0, &i2cParams);
// i2c_open defaults to master mode?
I2CMasterDisable(I2C0_BASE); // discard master settings
// Enable Slave operation
I2CSlaveEnable(I2C0_BASE);
I2CSlaveIntEnable(I2C0_BASE, I2C_SLAVE_INT_START | I2C_SLAVE_INT_STOP | I2C_SLAVE_INT_DATA);
I2CIntRegister(I2C0_BASE, i2c_callback);
// Enable Serial Power Domain
PRCMPeripheralRunEnable(PRCM_PERIPH_I2C0);
PRCMPeripheralSleepEnable(PRCM_PERIPH_I2C0);
HWREG(PRCM_BASE + I2CCLKGR) |= (1 << 0) | (1 << 8); // clk config
// Mandatory Load PRCM settings
HWREG(PRCM_BASE + CLKLOADCTL) |= (1 << 0);
// Configure IOC module to use I2C pins
IOCPinTypeI2c(I2C0_BASE, Board_I2C_SDA, Board_I2C_SCL);
// Write the slave address
HWREG(I2C0_BASE + I2C_SOAR) = 0x3E; // 0x3E
}
Could you help me please?



