This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#7178 - Sansa e200 FM tuner support
Attached to Project:
Rockbox
Opened by Ivan Z (zivan56) - Thursday, 17 May 2007, 01:11 GMT+2
Last edited by Michael Sevakis (MikeS) - Wednesday, 06 June 2007, 21:24 GMT+2
Opened by Ivan Z (zivan56) - Thursday, 17 May 2007, 01:11 GMT+2
Last edited by Michael Sevakis (MikeS) - Wednesday, 06 June 2007, 21:24 GMT+2
|
DetailsInitial support for the Sandisk Sansa e200 FM tuner (Sanyo LV24020LP).
It is initialized as soon as rockbox is started and there is no volume control (BEWARE if you use in ear headphones). Still needs to be done: - tuning (now tunes to around 91Mhz and AFC finds something nearby) - volume control - Recording Datasheets: http://www.rockbox.org/twiki/pub/Main/DataSheets/AN2400S04.pdf (explains in general how to tune) http://www.semiconductor-sanyo.com/ds_e/ENA0070.pdf (registers for this specific tuner) Make sure it put tuner_sanyo.c in the /firmware/ folder If someone could look into the tuning details, as the datasheet is not very specific in some parts. |
This task depends upon
Closed by Michael Sevakis (MikeS)
Wednesday, 06 June 2007, 21:24 GMT+2
Reason for closing: Accepted
Additional comments about closing: Now part of SVN.
Wednesday, 06 June 2007, 21:24 GMT+2
Reason for closing: Accepted
Additional comments about closing: Now part of SVN.
Charles
1.Very crude and causes possible race condition (tune very slowly to avoid this).
2.Set the region to US/Canada for best results.
3. Not using specifications, so frequencies are a bit off and hackish; see the FM debug screen for actual frequencies.
4. Scanning is not supported.
Buttons now work correctly, volume still needs to be figured out.
Initial radio start needs to be done correctly as well, as it starts on the main menu instead of the actual FM screen.
Scanning is supported, and scan time is somewhat acceptable. No more race conditions hopefully when scanning.
Initial tuning takes some time, but not a problem after that
Still need to work on muting when tuning, along with starting radio at proper time.
Volume support also needs to be implemented.
- Volume control now implemented
- Play/pause works
- Synced with SVN
Did some code cleanup as well.
Overall, quite usable now. Still have to force stereo, as an algorithm for fine tuning is needed.
Setting the region to Europe and fine adjusting manually usually allows you to get stereo sound. Adding +0.2Mhz to desired frequency seems to be what works for me, but it may not be a fixed offset for all frequencies.
- Synced with SVN
- Lowered gain on line1 in so that people with IEMs don't get high pitched sounds
No more whining noises
Have you booted to the OF radio before? I commented out the init part of the code so that the OF takes care of setting it properly.
I'm guessing the Euro version doesn't have the radio is because the small 50kHz frequency steps required means scanning will be dismally slow there...OF is nastily slow here with 200kHz ones and misses all sorts of stuff it should pick up. I've used the OF radio and it's pretty lousy and slow but all OF radio code I've checked is just that and doesn't work worth a 5#17.
Well, I'll try to remedy that if possible.
The radio works decently in Europe, I don't live there, but it caught quite a number of stations when set to the World region. It has trouble finding some stations, especially if the station is very close to another one. The reason they don't have radio support in Europe is due to the EU Radio tax, which would add on to the price of the player. Either way, the OF still works better than what I have posted...
radio5.diff had a totally different approach to scanning, which didn't work tool well, but I though it *should* have considering it was going though all cap/osc values and seeing which ones match the frequency best.
It would be interesting to compare results with a Cowon D2, which seems to have the same Sanyo chip.
To summarize what I've worked on from your code:
1) make code style follow rockbox guidelines
2) use symbolic constants for everything - defined them completely for all registers
3) automatic reg block switching and OR default "1" bits into RADIO_CTRL1 automatically
4) shadow writeable registers - this leaves a few single-byte gaps but tracking which bits are set isn't needed
5) reverse the IF_PM_L bit as clearing the bit mutes it - init steps 2 and 3 work fine now
7) actually write the FM_OSC value calculated by the cap searching routine - it _tends_ more toward tuning correcly (details below)
9) remove some unneeded stuff like the pow function
10) start adding things needed by the radio interface in general
11) implement radio regions directly in the driver - the details of region setting for the radio ICs really are low-level and I plan to address that for all others - radio.c can still implement the frequency ranges and grid
There could be a problem with precision in the math that seems to make it tune the chip to the same frequency for several different specifiec ones. If so, I have no problem using 64-bit ints or perhaps rescaling calulations will work too. Overflow can be a problem too. A scheme to speed up the searching will definitely be needed.
I bought it one month ago in Italy.
Unfortunately I haven't development environment to compile Rockbox, otherwise I could tray to do it.
If you send me a compiled version, I'd be happy to test it.
Setting the input level down is too quiet compared to playback btw.
TODO recap:
* Improve tuning algorithms more over Sanyo's to actually converge better and faster on the desired frequencies.
* Perhaps allow a few hundred HZ slop in the IF_OSC setting since this register bounces around a bit and is hard to set accurately which just leads to longer radio init at times. I don't know why it stays more stable for long runs then seems to be unruly for long runs. OF seems to take awhile to set this as well. hrm.
* Perhaps retune IF_OSC to have less interference from internal noise when tuning weaker stations? The OF suffers this too but the interference drops away when it idles the cores. In Rockbox, button/scrollwheel activity seems to improve reception...wtf?
* Really implement station detection to be accurate for scanning.
* Do all the other work to properly integrate radio into the e200 audio system.
patching file firmware/target/arm/sandisk/sansa-e200/ata-e200.c
Hunk #3 FAILED at 67.
Hunk #4 succeeded at 243 (offset 1 line).
Hunk #5 succeeded at 282 (offset 1 line).
Hunk #6 succeeded at 298 (offset 1 line).
Hunk #7 succeeded at 366 with fuzz 1 (offset -1 lines).
Hunk #8 FAILED at 417.
Hunk #9 FAILED at 434.
Hunk #10 FAILED at 499.
Hunk #11 succeeded at 580 (offset -1 lines).
Hunk #12 succeeded at 650 (offset -1 lines).
4 out of 12 hunks FAILED -- saving rejects to file firmware/target/arm/sandisk/s
ansa-e200/ata-e200.c.rej
Can't get current SVN to build with this patch applied, also it give out an error when patching. I attached the .rej file.
patching file firmware/drivers/audio/as3514.c
Hunk #1 FAILED at 114.
1 out of 1 hunk FAILED -- saving rejects to file firmware/drivers/audio/as3514.c.rej
I'm working on getting a patch working