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.

MSP430FR2476: Problem to implement BSL using I2C.

Part Number: MSP430FR2476

Tool/software:

Hi,

I'm implementing bsl using msp430fr2476.

I'm using msp430fr2476 as slave(bsl target) and the peripheral is i2c.

This is my main code.

1. set MCLK to 8MHz

2. initialize I2C as slave

3. jump to BSL

int main(void) {
	// Stop watchdog timer
	WDT_A_hold(WDT_A_BASE);
	initClock(); // set MCLK to 8MHz
	//__enable_interrupt();
	UCB0_I2C_slave_init();

	__disable_interrupt(); // disable interrupts
	((void (*)())0x1000)(); // jump to BSL
	
	while(true);
	return 0;
}

When i send BSL command from master mcu(ESP32) to msp430fr2476, response data is all 0.

I changed BSL I2C address using BSL configuration. But the result is same.

This is i2c master code. 

This code send mass erase cmd and i also send password cmd but result is same(all byte is 0).

	int ret = 0;
	int lcnt = 0;
	uint8_t read[32] = {0, }; 
	uint8_t writeb[32] = {0x80, 0x01, 0x00, 0x15, 0x64, 0xA3}; 

	i2c_cmd_handle_t cmd = i2c_cmd_link_create();

	ESP_LOGI(TAG, "bsl erase send");
	ESP_LOG_BUFFER_HEXDUMP(TAG, writeb, 6, ESP_LOG_INFO);
	
	i2c_master_start(cmd);   // send start condition
	i2c_master_write_byte(cmd, MSP430_BSL_ADDR << 1 | I2C_MASTER_WRITE, ACK_CHECK_EN); // slave address and write bit
	i2c_master_write(cmd, writeb, 6, ACK_CHECK_EN); // write bsl mass erase cmd
	i2c_master_start(cmd); // send start condition
	i2c_master_write_byte(cmd, MSP430_BSL_ADDR << 1 | I2C_MASTER_READ, ACK_CHECK_EN); // slave address and read bit
	i2c_master_read(cmd, read, 8, I2C_MASTER_LAST_NACK); // read 
	i2c_master_stop(cmd); // send stop condition

	xSemaphoreTake(i2c_semaphore, portMAX_DELAY);
	i2c_master_cmd_begin(I2C_MASTER_NUM, cmd, 0);
	xSemaphoreGive(i2c_semaphore);

Is there anything else I should set up on the msp430 for bsl?

Or, Is my read method wrong?

Regards,

Youngjun.

  • This was a problem with setting up an i2c address.

    The address set by ESP32 and the i2c slave address on msp430 did not match.

    Additionally, after jumping to BSL my code call CS_clearAllOscFlagsWithTimeout() function and does not leave the loop.

    I resolved this problem to add SFRIE1 &= ~OFIE. (I disabled interrupt, but I don't know why I get these problem.)

    int main(void) {
    	// Stop watchdog timer
    	WDT_A_hold(WDT_A_BASE);
    	initClock(); // set MCLK to 8MHz
    
    	__disable_interrupt(); // disable interrupts
    	SFRIE1 &= ~OFIE; 
    	((void (*)())0x1000)(); // jump to BSL
    }

**Attention** This is a public forum