Rockbox

Tasklist

FS#8046 - H10 Radio

Attached to Project: Rockbox
Opened by Barry Wardell (barrywardell) - Tuesday, 30 October 2007, 01:47 GMT
Last edited by Barry Wardell (barrywardell) - Sunday, 11 November 2007, 16:03 GMT
Task Type Patches
Category FM Tuner
Status Closed
Assigned To No-one
Operating System iriver H10
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

This is my first attempt at getting the FM radio working on the H10. I did this quite a while ago. Quite a few things have changed in svn since then, so I've done a quick sync and hopefully not missed anything.

Unfortunately, it doesn't seem to work at all right now and never did. The FM radio debug screen seems to indicate that the I2C communication with the device is somehow not working (at least some of those data bytes should be non-zero).
This task depends upon

Closed by  Barry Wardell (barrywardell)
Sunday, 11 November 2007, 16:03 GMT
Reason for closing:  Accepted
Comment by Przemysław Hołubowski (p.h.) - Friday, 09 November 2007, 21:01 GMT
I've changed i2c from hardware PP5020 i2c to software as i2c communication with tuner chip is done via software. Look at here: http://www.rockbox.org/twiki/bin/view/Main/PortPinAssignments#H10_GPIO
(fmradio_i2c.c)
Comment by Barry Wardell (barrywardell) - Friday, 09 November 2007, 21:24 GMT
There was a problem with the confusing #ifdef's in fmradio_i2c.c in the last patch. Hopefully this one will fix that up.
Comment by Jens Arnold (amiconn) - Saturday, 10 November 2007, 00:04 GMT
Same patch, but using the atomic GPIO bit manipulation macros (a feature of the PP502x), and without the unrelated Sansa e200rpatcher change.
Comment by Jens Arnold (amiconn) - Saturday, 10 November 2007, 01:16 GMT
One possible reason why it hangs could be that iriver forgot the SCL pullup (a familiar mistake, see the comment in the H1x0 part of fmradio-i2c.c) and we need to "prod-and-check" the SCL line, otherwise the clock stretch would be infinite.

Apart from that, this patch is a hack as it breaks FM radio on Ondio. Hijacking other arch's code isn't nice...
Comment by Przemysław Hołubowski (p.h.) - Saturday, 10 November 2007, 11:15 GMT
It seems SCL pullup is not the case as the patch using H1x0 i2c code does not work on H10 (booting still fails).
Comment by Barry Wardell (barrywardell) - Saturday, 10 November 2007, 12:22 GMT
I just tried this on my own H10. It looks like the wait for SCL is indeed causing problems. I #if 0'd out the two while loops and Rockbox now starts up fine. The debug screen even manages to report values for the regs. They read as:

Read: D0 78 02 00 BC
Write: 00 00 00 00 00

I'm not sure if these are right. I think it documents them in the datasheet, but haven't had a chance to take a proper look.

No luck with sound yet, too. We probably need to look a bit closer at the code in audio-pp.c for that. We'll also probably need to figure out what to do about the wait for SCL.
Comment by Jens Arnold (amiconn) - Saturday, 10 November 2007, 22:57 GMT
New patch, implementing the H1x0 way of handling clock stretching on H10, correcting 2 goofs of my old patch as well. Also adapted to the fmradio i2c drivers residing in target tree.

The driver seems to talk to the chip just fine, tuning finds a signal where expected in my area, but there's no sound yet. Also, the radio controls are messed up so the only thing that works is tuning....
Comment by Jens Arnold (amiconn) - Saturday, 10 November 2007, 23:45 GMT
New patch, including a working keymap.
Comment by Michael Sevakis (MikeS) - Sunday, 11 November 2007, 03:55 GMT
We just need to set inputs properly on the WM chip then? I left a TODO: in there in audiohw_set_monitor.
Comment by Barry Wardell (barrywardell) - Sunday, 11 November 2007, 12:54 GMT
I've implemented audiohw_set_monitor() from my understanding of the WM8731 datasheet.

I also changed audio_set_recvol() to set the volume to 0dB. It makes sense to me that it should be set that way. Is there any reason it was set to -34.5dB (LINVOL = 0) previously?

Still no success, however. Turning the volume up to max, I can hear faint random noise, which does respond slightly to changing station.
Comment by Barry Wardell (barrywardell) - Sunday, 11 November 2007, 16:03 GMT
I've just committed this version of the patch to SVN. The problem as suggested by jhMikes on IRC was that the setting of the bit in GPIOB2 was backwards

Loading...