i recently bought the Portenta Max Carrier and i would like to output (DAC) some audio-signlas.
Baseically the question is: How to do so?
Since the onboard DAC-chip CS42L52 on the Max Carrier is communicating with the Portenta via I2C the question is:
on which channel of the 3 I2C-channels of the Portenta the CS42L52 is connected to?
what is the I2C-address of the CS42L52 on the Max Carrier
I would also appreciate if anyone can link me to a propper and great manuel/datasheet which can answer my question or at least help me to get better in this problem.
Actually, you could find the potential I2C slave address in Audio chip datasheet: CS42L52 datasheet
I2C slave address is:
b'1001_01AD0 + R/nW bit
So, a 7 bit address where bit 0 is set as 0 or 1 via hardware (no idea without schematics).
If you do not find schematics (I could not!), or you cannot find I2C address in Arduino code - there is option to use I2C on Portenta and to try to find a valid slave address and ChipID of audio chip:
If you try I2C with several I2C slave addresses - iterate over 128 -1 possible addresses (slave address 0 is General Call - no need to try) - and you find a slave - try to read the register with ChipID for audio chip. If it matches - you have found it.
But based on Audio chip datasheet: just try slave addresses as b'1001010 and b'1001011 - then you can find ChipID of this chip (or any other register value which makes sense).
Nice Great big THX
it works to read the ChipID (1st register on the CS42L52)
Also the others are readable
#include <Wire.h>
void setup() {
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(115200);
}
void loop() {
Wire.beginTransmission(0x4a); // 0x4a = 0b1001010 (6MSB for Chip-Address + AD0 = 0)
Wire.write(0x01); // Instruction 0x01 is queued which will be read as the Register-Address to be read from by the CS42L52
Wire.endTransmission(); // Instructionpackage (Chip-Address + Register-Address) will be sended to the CS42L52
Wire.requestFrom(0x4a, 1); // requesting the 1byte long answer (content of register 0x01 = ChipID + Chip-Revision) from the CS42L52
while (Wire.available()) {
uint8_t c = Wire.read(); // reading the answer
Serial.println(c); // printing the answer
}
delay(1000);
}
Now that i can read all the setting registers and manipulate them is the question:
How to make ths audio DAC to put out something (first just a DC signal at some certain values)
i didnt see a register in the manual to do so
where/what is the data register, where i can transfer a value from the portenta via I2C or some think else that makes the DAC putting out the representiv voltage?