ES9028Q2M controller design

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
As we all know the ESS DACs are protected by NDA so that the open source driver is not an option as it requires publishing the internal register definition. People use a dedicated microcontroller (MCU) as a middle-man to control the DAC to work it around. In this way, an open source driver for the MCU can be published and the real ESS DAC register definition can be hidden in the MCU firmware.
I was trying to DIY such an MCU for the last few days and would like to share what I have achieved.

I choose AVR ATXmega64A4U as the MCU as it is cheap, reliable and easy to use. TQFP44 with 0.8mm pitch is also easy to solder. The MCU has two I2C module, the idea is to configure one of them as the I2C slave to receive commands from RPi and configure the second one as the I2C master to overlay the command to the DAC. This way I can write an open source driver for the MCU (with a list of fake register definition) and use the MCU as the I2C command translator. In my test, I use a 16-bit register address and randomly map all the ES9028Q2M register address to a 16-bit address and it works quite well.

The PCB design can be found here:

GitHub - VinnyLorrin/ES9028-controller-PCB

The layout is quite simple. SDA/SCL from RPi connects to the I2C slave module, SDA/SCL from the master module connects to the DAC. Plus two PDI wires for programming and VDD/VSS.

The firmware source code can be found here:

GitHub - VinnyLorrin/ES9028Q2M-controller

It is developed based on the TWI example from ATMEL. The readme file contains more info. Note that the ES9028Q2M register definition is deleted from the source file but I have uploaded a pre-compiled binary file that contains the register definition and ready to work.

The Linux driver source code can be found here:

GitHub - VinnyLorrin/ES9028-controller-Linux-Driver

The ALSA driver is divided into three parts: a platform driver that is provided by the Raspbian system; a codec driver that controls the DAC and a machine driver bind the platform driver and codec driver together. To reuse the driver code, you only need to modify the codec driver (*-codec.c) to fit your need. Just be careful to all the id strings that the machine driver is looking for to match the platform and codec driver.

The codec driver architecture is also straightforward. ALSA has a batch of pre-defined call back function that will be called when a certain event is triggered. For example, during the boot, the initialization callback function will be called. If a user clicks play bottom anther callback function will be called. The codec driver needs to implement these functions and register them to the ALSA so that when an event happens, the right function can be called that sets the DAC registers to the right values.

I tried to comment the code as clearly as I can. Hopefully, it can provide some help.
 
:) looking to try this soon !

Was most impressed by your previous ES9028 driver :D;):cool:

Will this be of use for other than ES9028Q2m ?
maybe ES9038Q2m or ES9018K2m ?

This one will be a little bit harder to set up for trying. You need to build the controller PCB, buy and solder the parts, buy a programmer to flash the MCU.

The controller is just a I2C command translator, it should be able to work with other DAC, maybe with a little change in firmware and/or Linux driver. It is also possible to make the firmware compatible with multiple DACs in one setup but that will increase the size of the firmware. The free IAR license has a 8KB size limitation, unfortunately.
 
@gandolf thank you for posting this controller. hopefully i'm not too late in replying to this. i'm going to try this in my diy project but i'm not very familiar with linux and raspberry pi. would you mind if i came to you for some technical help?

regards
sam
 
@gandolf thank you for posting this controller. hopefully i'm not too late in replying to this. i'm going to try this in my diy project but i'm not very familiar with linux and raspberry pi. would you mind if i came to you for some technical help?

regards
sam

I was planning to reply on weekend. Yes, you can, please post your question here. I don't have too much time these days but I will try my best.
 
@gandolf

I follow the ' README.md ' to install the ' ES9028 controller Linux Driver ', I can't get the Kernel Source by using ' rpi-source -d .'

The OS is ' 2018-06-27-raspbian-stretch-lite ', Raspberry Pi 3B get something of this:

pi@raspberrypi:/ $ rpi-source -d .

*** Updating rpi-source
--2018-09-27 22:59:05-- https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.164.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.164.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12667 (12K) [text/plain]
Saving to: ‘/usr/bin/rpi-source’

/usr/bin/rpi-source 100%[=================================================>] 12.37K --.-KB/s in 0.005s

2018-09-27 22:59:05 (2.31 MB/s) - ‘/usr/bin/rpi-source’ saved [12667/12667]


*** Set update tag: d519da21aa89bbf046700468c338f69ce9955309

*** Restarting rpi-source

*** gcc version check: OK

*** Using: /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz

*** Latest firmware revision: 748fb17992426bb29d99224b93cb962fefbdc833

*** Linux source commit: f1a1eec4c38d3c36b67c609f6c27805d04dab978

*** Download kernel source
/linux-f1a1eec4c38d3c36b67c609f6c27805d04dab978.tar.gz: Permission denied
Traceback (most recent call last):
File "/usr/bin/rpi-source", line 337, in <module>
sh("wget %s -O %s https://github.com/raspberrypi/linux/archive/%s.tar.gz" % (("-q" if args.quiet else ""), linux_tar, kernel.git_hash))
File "/usr/bin/rpi-source", line 85, in sh
subprocess.check_call(cmd, shell=True)
File "/usr/lib/python2.7/subprocess.py", line 186, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'wget -O /linux-f1a1eec4c38d3c36b67c609f6c27805d04dab978.tar.gz https://github.com/raspberrypi/linux/archive/f1a1eec4c38d3c36b67c609f6c27805d04dab978.tar.gz' returned non-zero exit status 1

Any suggestions, and solutions are appreciated.
 
@gandolf

I follow the ' README.md ' to install the ' ES9028 controller Linux Driver ', I can't get the Kernel Source by using ' rpi-source -d .'

The OS is ' 2018-06-27-raspbian-stretch-lite ', Raspberry Pi 3B get something of this:

pi@raspberrypi:/ $ rpi-source -d .

*** Updating rpi-source
--2018-09-27 22:59:05-- https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.164.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.164.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12667 (12K) [text/plain]
Saving to: ‘/usr/bin/rpi-source’

/usr/bin/rpi-source 100%[=================================================>] 12.37K --.-KB/s in 0.005s

2018-09-27 22:59:05 (2.31 MB/s) - ‘/usr/bin/rpi-source’ saved [12667/12667]


*** Set update tag: d519da21aa89bbf046700468c338f69ce9955309

*** Restarting rpi-source

*** gcc version check: OK

*** Using: /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz

*** Latest firmware revision: 748fb17992426bb29d99224b93cb962fefbdc833

*** Linux source commit: f1a1eec4c38d3c36b67c609f6c27805d04dab978

*** Download kernel source
/linux-f1a1eec4c38d3c36b67c609f6c27805d04dab978.tar.gz: Permission denied
Traceback (most recent call last):
File "/usr/bin/rpi-source", line 337, in <module>
sh("wget %s -O %s https://github.com/raspberrypi/linux/archive/%s.tar.gz" % (("-q" if args.quiet else ""), linux_tar, kernel.git_hash))
File "/usr/bin/rpi-source", line 85, in sh
subprocess.check_call(cmd, shell=True)
File "/usr/lib/python2.7/subprocess.py", line 186, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'wget -O /linux-f1a1eec4c38d3c36b67c609f6c27805d04dab978.tar.gz https://github.com/raspberrypi/linux/archive/f1a1eec4c38d3c36b67c609f6c27805d04dab978.tar.gz' returned non-zero exit status 1

Any suggestions, and solutions are appreciated.

The log said permission denied. You should use root account to do the operation.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.