Examples, how good are they?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Examples, how good are they?

841 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jaguarondi on Mon Feb 15 08:43:07 MST 2010
Well, I've the RDB1768 development board and the first example I've been working on is "RDB1768cmsis_AudioMeter".

I have to say that I'm quite afraid when I see that. Basically it works, I compile and executes, audio is looped from line-in to line-out and level meters are displayed. Tuning it was a real nightmare, I couldn't get anything I2S work as expected until I realized most of the code is completely wrong.

First the I2C module isn't correct at all, the ACK/NACK management is wrong in both read and write functions. The result was that the audio codec was never programmed as it should have been. As the codec was in default master mode, it is generating the I2S clock that the LPC tries to override by also generating it. This explains why changing registers on the I2S peripheral didn't work like expected. On the example, values for I2S peripheral seem to have been chosen by trial and error until something works. They're wrong but just work on the faster clock from the codec.
The codec is right justified by default while the code and comments say it's I2S so there are some obscure shifts added to deal with the right justified data received why obviously in I2S the shifts shouldn't be there.

In the end, I had to correct the I2C module, then configure the codec correctly (values in the example are not correct) and read/write the I2S data as it should.

I must admit that I'm quite afraid reading some other code from the examples when I see how wrong this one was. Any experience?

Thank you

David
0 Kudos
Reply
3 Replies

818 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by maxlobovsky on Thu May 27 08:02:56 MST 2010
Is anyone willing to post their improved i2c code?  I've been having trouble with the example code?
0 Kudos
Reply

818 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ktownsend on Wed Feb 24 05:27:31 MST 2010
I'd say anything you didn't write and thoroughly test yourself should always be treated with a bit of suspicion, even when it comes from the manufacturer. I've found a couple problems myself with the examples from NXP, but I'm really grateful that they've been providing sample code for all of their new devices since it makes my life far easier. I'm able to get a board and all the peripherals up in running in a day or two rather than several weeks.

Mistakes are bound to happen ... but I'm still pretty glad that NXP (and others) are providing something 98% accurate. Even if it takes time to test it all to get the last 2% I'm still way ahead on the learning curve. My experience so far with the examples has been positive ... the only tip I'd give is to compare the Keil and LPCXpresso packages since they differ. The Keil ones generally tend to be more complete, covering certain peripherals that aren't demonstrated in the LPCXpresso package.

[B]Edit:[/B] Hmm ... reading through your comments, it seems there perhaps are some more serious issues than I've encounter on any of the peripherals on the 1100 and 1300 chips.  Not having worked with the 1700 demo code, though, I can't really comment on the I2S issue.  I2C is the only peripheral I haven't implemented yet on the 1100/1300, though, since I didn't really like the way it was implemented in the demo code anyway and wanted to do it myself.
0 Kudos
Reply

818 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_USA on Wed Feb 24 04:11:01 MST 2010

Quote: jaguarondi
Well, I've the RDB1768 development board and the first example I've been working on is "RDB1768cmsis_AudioMeter".

I have to say that I'm quite afraid when I see that. Basically it works, I compile and executes, audio is looped from line-in to line-out and level meters are displayed. Tuning it was a real nightmare, I couldn't get anything I2S work as expected until I realized most of the code is completely wrong.
...
Thank you

David



Hello David,

I have reported the problems with this example to Code Red. There are many example included with LPCXpresso from different vendors. Some are written by NXP and based on detailed application notes. Some are by Code Red, some are by Embedded Artists, and some are by yet other tool vendors. We apologize for the problems you experienced with this specific example and thank you for providing feedback so we can continue to improve the development tool products.

-NXP
0 Kudos
Reply