• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category FM Tuner
  • Assigned To No-one
  • Operating System iriver H10
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by barrywardell - 2007-10-30
Last edited by barrywardell - 2007-11-11

FS#8046 - H10 Radio

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).

Closed by  barrywardell
2007-11-11 16:03
Reason for closing:  Accepted
p.h. commented on 2007-11-09 21:01

I've changed i2c from hardware PP5020 i2c to software as i2c communication with tuner chip is done via software. Look at here:

There was a problem with the confusing #ifdef's in fmradio_i2c.c in the last patch. Hopefully this one will fix that up.

Same patch, but using the atomic GPIO bit manipulation macros (a feature of the PP502x), and without the unrelated Sansa e200rpatcher change.

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…

p.h. commented on 2007-11-10 11:15

It seems SCL pullup is not the case as the patch using H1x0 i2c code does not work on H10 (booting still fails).

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.

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….

New patch, including a working keymap.

MikeS commented on 2007-11-11 03:55

We just need to set inputs properly on the WM chip then? I left a TODO: in there in audiohw_set_monitor.

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.

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


Available keyboard shortcuts


Task Details

Task Editing