|AR1688 Programming Lesson 101|
| || |
|March 31, 2011|
|I know it is too late to write AR1688 lesson 101 after it is in market over 4 years. But late is better than never.
Every now and then there are people asking How can I change that GP1266 LCD display to my own string?
I started this article because I read an email asking it again just now.
Actually this article is to be very short. In software API sdcc\src\ui_str.c, there is a LoadString function,
and there are already several OEM_XXXX changes made to display different strings.
Change LoadString will not only change the LCD display, but will change SIP User-Agent head as well.
|Update on Jan 7, 2012|
|Many users need to add their own UDP or TCP connection.
Each connection implementation is in a separate file with AR1688 software. This lesson is about how to add a file to AR1688 software API. Detail steps:
- Decide which bank the new file is going to be located. We recommend to put TCP connection in bank 3 and UDP in bank 2.
- Modify the two .c file related locations in sdcc\src\makefile.
- Add the new .rel file to sdcc\src\linkmain.lnk. Do NOT put it in the end of the file, MUST put it together with other .rel files in the same bank,
otherwise compile message like Error: banked code exceeded bank 7 end (default 0xe000) will occur. Or worse, the error message do not occur but we get wrong link results.
- Do NOT do any global var initialization like UDP_SOCKET _pTestSocket = NULL; in the new file (and do NOT add any in old files as well),
do var initialization in functions like SntpInit. Otherwise compile message like Error: sram code exceeded code end (default 0x2000) will occur.
SDCC can not put the initialization code in (correct) address we need with our banked software structure.
|Update on Feb 26, 2012|
|PCMU IVR was designed to read out IP address, providing an easy way to know the IP of an AR1688 device when LCD is not used.
In recent months there were increasing interest of adding interactive voice response during a call according to what kind of key user pressed among AR168M VoIP module customers.
And one of them was actively developing G.729 IVR function during the past week. The contents of this lesson were generated along with the supporting work for this customer.
First we need to prepare compressed G.729 data, this work can be done by PalmTool,
and the complete source code of PalmTool can be found in PA1688 software API, the latest version was 1.68.
The G.729 source code used in PalmTool was downloaded from ITU-T.
In the demo code of software 0.57.006, we used a simple way to get G.729 compressed data.
PA1688 ring tone is the combination of G.723.1 and G.729 compressed data, the first 2/5 is G.723.1 and the rest 3/5 is in G.729 format.
I downloaded PA1688 ring tone alice.dat, renamed it to font_alice.dat and saved it to sdcc\src\res.
Next we need to save the G.729 data to flash. Same as PCMU, we still use the font page of 8-11.
To make things simple, now we support command line like tftp -i xxx.xxx.xxx.xxx put font_alice.dat to upgrade font and IVR directly.
Then we need to read the G.729 data and send to peer during a call. As the data is stored on flash, the code to read it needs to run on SRAM instead of flash,
main.c is a good choice for it. We also need an easy way to send the data periodically, as TaskOutgoingData function in main.c is usually called by DSP at regular intervals,
it is a good point to replace the DSP compressed G.729 data with our data read from flash. The demo code is grouped with SYS_IVR_G729 define,
which is included when compile with newly added OEM_IVRG729 or existing OEM_ROIP options.
Finally I have to say that the demo code still need a lot more improvement before it can be actually used in a real product.
For example, need to check if current using CODEC is G.729 or not before we replace data.
And with RoIP application when VAD is used, TaskOutgoingData may not be called because of no voice activity,
and the send data work will need to be done in _10msCounter function in isr_gpio.c. Also more banking access code is needed when total G.729 data is over 32k bytes.