2022-01-19 04:16 AM
2022-01-19 05:29 AM
Show us what you already have done.
JW
2022-01-19 11:54 PM
Thank you for your response
Below is the Arduino Mega code
int receivedByte = 0;
void setup()
{
Serial.begin(9600); //MEGA TO PC
Serial1.begin(9600); //MEGA TO STPM32
delay(10);
}
void loop()
{
Serial1.write(0x48); // register for voltage and current read address
Serial1.write(0xFF); // no write ADDRESS so (0xFF)
Serial1.write(0xFF); // WRITE DATA
Serial1.write(0xFF); // WRITE DATA
Serial1.write(0x22); //crc value after calcultion
Serial.println("data sent: (48 FF FF FF 22) "); //Print in PC
Serial.println();
Serial.print("I received: ");
while (Serial1.available() > 0)
{
receivedByte = Serial1.read();
Serial.print(receivedByte, HEX); //here I'm receiving default value of all register
}
Serial.println();
Serial.println();
delay(1000);
}
Data recived for 48FFFFFF is 000000
Register for voltage and current
Data recieved for 0FFFFFF is A000475
//Register address 0x00 as per data sheet default value is 040000A0 (just the reverse of what i recived)
48FFFFFF22 Transmit Data
Revieve Data for 48FFFFFF22
00FFFFFFF0 Transmit Data
Recieve data for 00FFFFFFF0
2022-01-20 11:46 PM
Do we need to send any initialization command ?
2022-02-21 08:33 AM
Hello,
No, you do not need to send any init command to get the chipset ready.
Nevertheless, you need to enable the "Data latch" to get the values latched in the data register (see register dsp_cr3):
Another option is to use the "manual" HW latch (pulse on signal SYN, see DS).
The content of the register 0 you received is correct (0xA0 00 00 04, as frame format is LSBfirst).
I put in attached an Application Note which should be very helpful for understand the UART communication for STPM3x and the init phase.
Best regards,
Didier Herrouin
2022-02-21 08:33 AM