xcore-200 mc as i2c slave
Posted: Mon Mar 05, 2018 5:33 pm
I need to configure app_usb_audio as i2c slave and hope to get some suggestions for how this might be implemented in the software since the default app is configured as i2c master for ADC and DAC control. Have Raspberry pi as i2c master.
Have successfully tested the i2c slave app in AN00157 and imagine that it should be possible to extend app_usb_audio with corresponding i2c slave functionality. Possible sequence for sample change on usb:
0. app_usb_aud detects sample rate change on usb audio
1. app_usb_aud interrupts the pi through a gpio pin.
2. pi as i2c master asks xmos i2c_slave for the required sample rate, provided through the i2c_slave_register_file
3. pi configures the pll for the requested sample rate
I believe that, in principle…, this must be done in app_usb_audio:
* src/extensions/audiohw.xc: remove i2c related ADC/DAC-code, replace init of i2c master to i2c_slave
* module_usb_audio/main.xc: add components such as i2c_slave_register_file() and slave_application() from AN00157 in order to exchange data between raspberry and xmos. Should I also assume that I should put i2c_slave_callback_if i_i2c, and i2c_slave(i_i2c, p_slave_scl, p_slave_sda, device_addr) in main.xc?
All comments appreciated.
Have successfully tested the i2c slave app in AN00157 and imagine that it should be possible to extend app_usb_audio with corresponding i2c slave functionality. Possible sequence for sample change on usb:
0. app_usb_aud detects sample rate change on usb audio
1. app_usb_aud interrupts the pi through a gpio pin.
2. pi as i2c master asks xmos i2c_slave for the required sample rate, provided through the i2c_slave_register_file
3. pi configures the pll for the requested sample rate
I believe that, in principle…, this must be done in app_usb_audio:
* src/extensions/audiohw.xc: remove i2c related ADC/DAC-code, replace init of i2c master to i2c_slave
* module_usb_audio/main.xc: add components such as i2c_slave_register_file() and slave_application() from AN00157 in order to exchange data between raspberry and xmos. Should I also assume that I should put i2c_slave_callback_if i_i2c, and i2c_slave(i_i2c, p_slave_scl, p_slave_sda, device_addr) in main.xc?
All comments appreciated.