Need some strings ** EDITED**
TC
Posts: 1,019
Hello all,
Its been a long while since I've been on here. Things have changed.
WOW, I have been gone a while. It also does not help being tired when writing a post. Lets try this again, but make a lot more sense.(referring to striked out portion.)
I am working with TI's TLV320AIC3254 audio DSP chip. It works good for me, and only requires a I2C com to work with it. The prop does a great job. I can do basic stuff with it like adjust the volume. But I want to do more.
The chip has countless registers, on countless pages(im to lazy to count all of them). Texas Ins, has a program called PurePath that is able to take a DSP design compile code to load to the chip. The code has to be loaded every time the chip is powered up. The code is loaded by either a PC, or a MCU. I am going to use the prop to load the code. Right now I am only trying to get the prop to load a basic DSP program into it. Then after I have it working, figure a way to store in to EEPROM, the startup code, the EQ code, the EQ values, etc...
But I am a little stuck. I am currently using JonnyMac's I2C driver, because it is easy, and it is faster for me to get a basic feel for it. Data is sent to the chip in 8-bit segments. First the device ID is sent, then the starting register, then the data for that register. This is TI's syntax for the chip; W 30 20 01. That would write a $01 into register $20. I can load one register with no problem, its when I get to loading many registers at a time that I am having problems.
I would like to try (not a requirement) to keep something like TI's syntax. I am currently using(doing this from memory, since I am at work):
It works for sending one value, but PurePath will output a string of values for certain things. For example, loading a Biquad, I have seen where it loads 50 registers at a time, in one string.
W 30 20 00 02 05 34 5A 9A ETC.....
But my code doesn't, I have to do one at a time. I would like to have it the way TI has it, where the same code can load one register, or many registers. I have tried adding "string" before the "data" tag, and that works as long as there is no $00 values. But there are a lot of $00 values that are loaded.
So my question is, what ideas does anyone have that might work? Or maybe someone might have a better idea then I have? Please, I want this to work, but I also dont want to have to spend days to months just taking the PurePath output, and copying to the prop by hand.
Thanks for any input you have
TC
TI's command interface syntax is;
W 30 00 00
W = write
30 = device id
first 00 = starting register
second 00 = data
Thats the easy part for me. Its when I get into having to load consecutive registers.
W 30 04 03 91 08 00 00
Im trying to keep the syntax around the same(if I can). That way I can easily take what PurePath(TI's DSP program) figures out, and have the prop load the chip.
I was wondering if anyone has some ideas that might help me?
Also, I would like to have the prop read an EEPROM, and load the values into TI's chip. but thats at a later date.
Thanks
TC
Its been a long while since I've been on here. Things have changed.
WOW, I have been gone a while. It also does not help being tired when writing a post. Lets try this again, but make a lot more sense.(referring to striked out portion.)
I am working with TI's TLV320AIC3254 audio DSP chip. It works good for me, and only requires a I2C com to work with it. The prop does a great job. I can do basic stuff with it like adjust the volume. But I want to do more.
The chip has countless registers, on countless pages(im to lazy to count all of them). Texas Ins, has a program called PurePath that is able to take a DSP design compile code to load to the chip. The code has to be loaded every time the chip is powered up. The code is loaded by either a PC, or a MCU. I am going to use the prop to load the code. Right now I am only trying to get the prop to load a basic DSP program into it. Then after I have it working, figure a way to store in to EEPROM, the startup code, the EQ code, the EQ values, etc...
But I am a little stuck. I am currently using JonnyMac's I2C driver, because it is easy, and it is faster for me to get a basic feel for it. Data is sent to the chip in 8-bit segments. First the device ID is sent, then the starting register, then the data for that register. This is TI's syntax for the chip; W 30 20 01. That would write a $01 into register $20. I can load one register with no problem, its when I get to loading many registers at a time that I am having problems.
I would like to try (not a requirement) to keep something like TI's syntax. I am currently using(doing this from memory, since I am at work):
OBJ com : "jm_i2c" PUB W(reg, data) com.wait($30) 'TI chip address com.write(reg) 'send register location com.write(data) 'load data com.stop 'send stop bit
It works for sending one value, but PurePath will output a string of values for certain things. For example, loading a Biquad, I have seen where it loads 50 registers at a time, in one string.
W 30 20 00 02 05 34 5A 9A ETC.....
But my code doesn't, I have to do one at a time. I would like to have it the way TI has it, where the same code can load one register, or many registers. I have tried adding "string" before the "data" tag, and that works as long as there is no $00 values. But there are a lot of $00 values that are loaded.
So my question is, what ideas does anyone have that might work? Or maybe someone might have a better idea then I have? Please, I want this to work, but I also dont want to have to spend days to months just taking the PurePath output, and copying to the prop by hand.
Thanks for any input you have
TC
TI's command interface syntax is;
W 30 00 00
W = write
30 = device id
first 00 = starting register
second 00 = data
Thats the easy part for me. Its when I get into having to load consecutive registers.
W 30 04 03 91 08 00 00
Im trying to keep the syntax around the same(if I can). That way I can easily take what PurePath(TI's DSP program) figures out, and have the prop load the chip.
I was wondering if anyone has some ideas that might help me?
Also, I would like to have the prop read an EEPROM, and load the values into TI's chip. but thats at a later date.
Thanks
TC
Comments
Would this help: http://www.robot-electronics.co.uk/i2c-tutorial ?
It does have some good information, but it does not help me figure out the best, and easiest way to send varying amounts of data to the TI chip. Most of the commands are looking for the order in first post. But then other times it is looking for consecutive register writes. Thats what I am really getting stuck on.
I assume that your data is in some kind of buffer or table. I would write a routine that takes 4 parameters: the device address, the starting register number, the number of bytes of data to be sent, and the address of the first byte of data like: PUB writeBlock( devAddr, regStart, dataCnt, dataAddr). Your routine would look somewhat like:
You could then call writeBlock for each group of registers you want to initialize. I would probably set up a table with each entry containing a starting register number, a byte count, then that number of data bytes. A byte count of zero would mark the end of the table. A simple loop would go through the table using writeBlock to set up each group of registers.
That is exactly what I was trying to think of, but I was having trouble figuring it out. I've been away from the prop for a couple months, and I have forgotten some of the things I use to do. Sometimes is sucks having brain trauma.
I do like that way you showed. I can use it to read an EEPROM as well.
Thank you
I am using only because the development board I am using has a 256k EEPROM on the I2S lines, and its address is the same as the props. ** ADDED ** The EEPROM is for the USB chip. It holds the USB config data. It does not hold the DSP chip data. I wish it did though, I would just copy it, and reload it.
I thought of that, but the TI chip has 186 pages of 127 registers each (23,622 registers). That is way to many registers for me to load the default values for all the registers (by hand maybe), just to have a consistent way to load the chip. I did start doing that though. But when I figured out how many registers this thing had, it changed my mind.
I am working on that. There are a couple guys at work that are great at VB programing. I'm going to see if they could make a simple script that would take a .txt file, reformat it for the prop, then I could copy and paste. But right now they are busy, so I have to wait.
If you have a .txt file on the pc you can send it to the prop and have a simple spin program convert it to the format you want. Done that for a pdf listing to convert the ascii characters to hex.