Skip to content

LTC68X - I2C/SPI not shifting out data #62

@DerZwergGimli

Description

@DerZwergGimli

There is a problem with the "LTC681X.cpp". It's not shifting out any data. The function that is not working is the "void LTC681x_stcomm(uint8_t len)"

a possible solution to this is this...

/* Shifts data in COMM register out over LTC681x SPI/I2C port */
void LTC681x_stcomm(uint8_t len) //Length of data to be transmitted
{
	if (len > 0)
	{
		uint8_t cmd[4];
		uint16_t cmd_pec;
		cmd[0] = 0x07;
		cmd[1] = 0x23;
		cmd_pec = pec15_calc(2, cmd);
		cmd[2] = (uint8_t)(cmd_pec >> 8);
		cmd[3] = (uint8_t)(cmd_pec);

		uint8_t data[len * 3];
		uint16_t data_pec;

		for (size_t i = 0; i < len * 3; i++)
		{
			data[i] = 0xFF;
		}

		cs_low(CS_PIN);
		spi_write_array(4, cmd);
		spi_write_array(len * 3, data);
		cs_high(CS_PIN);
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions