Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - kitor

#401
General Development / Re: Digging into audio code
July 24, 2015, 04:14:07 PM
No, and that's one of reasons why I asked :) So looks like EOT in terms of old code, what's left from my post is
Quote- Optional: Add "external mono left" and "external mono right" - they are useful also when you have eg. xlr to stereo jack cable connected to mono microphone, or have y-adapter with two mics each on own channel, and want to select it (already tested by me on 5d2 and works ok)
but it seems to be easy to implement in new branch.
#402
General Development / Digging into audio code
July 23, 2015, 11:41:20 AM
As I had hardware problem with right mic channel in my 5d2 (http://www.magiclantern.fm/forum/index.php?topic=15541.0), I played with source code a bit.
My first thoughts - while audio-lapis.c is using tons of obvious named constants, old "audio-ak.c" is documented very poorly. They have even identical headers, so for "new" person like me it took a while
to understand why they both exist.
Also, audio-ak has different styles of coding mixed, eg function declared in single line:
static inline unsigned mgain_index2gain(int index) // sorted mgain values
while a bit later
static inline uint8_t
audio_gain_to_cmd(
                  int                   gain
                  )
{


I found also things like (in void audio_configure( int force ) )
#ifdef CONFIG_500D
    audio_ic_write( AUDIO_IC_SIG4 | pm3[input_source] );
#else
    //PM3 is set according to the input choice
    audio_ic_write( AUDIO_IC_PM3 | pm3[input_source] );
#endif
   

and guess what... AUDIO_IC_SIG4 and AUDIO_IC_PM3 have the same addresses (0x3000), and that's the only one reference of this register I could find in source...
ofc I get it, by registers definition I belive that 500d uses other (yet similar) controller and thus different register names, but i can't find information what controller is used.

As I had to (first understand at all and then) modify audio_configure function, now it looks more like (ofc it's not final form, and only part of function, note comments with what each bit of register does)

//this should be moved to header file

//left channel path is controlled by D0 of AUDIO_IC_PM1
#define ML_RECORD_PATH_MICL2LCH 0x01
#define ML_RECORD_PATH_MICR2LCH 0x00
//right channel path is controlled by D0 of AUDIO_IC_PM3
#define ML_RECORD_PATH_MICL2RCH 0x00
#define ML_RECORD_PATH_MICR2RCH 0x01
//right channel is defined by D2 of AUDIO_IC_PM3
#define ML_RCH_MIXER_INPUT_SINGLE_INT     0x00
#define ML_RCH_MIXER_INPUT_SINGLE_EXT     0x04

//left channel is defined by D1 of AUDIO_IC_PM3
#define ML_LCH_MIXER_INPUT_SINGLE_INT     0x00
#define ML_LCH_MIXER_INPUT_SINGLE_EXT     0x02

//differential on left is
#define ML_MIC_IF_CTL_SINGLE  0x00
#define ML_MIC_IF_CTL_DIFFER  0x10

#define ML_AUDIO_ENABLE_ADC_DAC 0x6C

#define ML_SPK_ENABLE 0x10
#define ML_MIC_POWER_ON 0x04
#define ML_MIC_POWER_OFF 0x00

#define ML_MIXER_MONO_INPUT 0x04

    if( !force )
        {
            // Check for ALC configuration; do nothing if it is
            // already disabled
            if( audio_ic_read( AUDIO_IC_ALC1 ) == gain.alc1
                &&  audio_ic_read( AUDIO_IC_SIG1 ) == gain.sig1
                &&  audio_ic_read( AUDIO_IC_SIG2 ) == gain.sig2
                )
                return;
            DebugMsg( DM_AUDIO, 3, "%s: Reseting user settings", __func__ );
        }

    audio_ic_write( AUDIO_IC_PM1 | ML_AUDIO_ENABLE_ADC_DAC | ML_RECORD_PATH_MICL2LCH ); // power up ADC and DAC

#ifdef CONFIG_500D //500d only has internal mono audio :(
    int input_source = 0;
    int mic_pow = 1;
#else
    int input_source = get_input_source();
    #ifdef FEATURE_MIC_POWER
        //mic_power is forced on if input source is 0 or 1
        int mic_pow = get_mic_power(input_source);
    #else
        int mic_pow = 1;
    #endif
#endif
    audio_ic_write( AUDIO_IC_SIG1 | ML_SPK_ENABLE | ( mic_pow ? ML_MIC_POWER_ON : ML_MIC_POWER_OFF )); // power up, no gain
    audio_ic_write( AUDIO_IC_SIG2 | ML_MIXER_MONO_INPUT | ( lovl & 0x3) << 0 // line output level
                    );

    //PM1 holds ADC & DAC enable + LR select on L channel
    //PM3 holds INT/EXT select for L and R channels, balanced mode and LR select on R channel
    switch (input_source)
        {
        case 0: //LR internal mic
            audio_ic_write( AUDIO_IC_PM3 | ML_LCH_MIXER_INPUT_SINGLE_INT | ML_RCH_MIXER_INPUT_SINGLE_INT | ML_RECORD_PATH_MICL2RCH);
            audio_ic_write( AUDIO_IC_PM1 | ML_AUDIO_ENABLE_ADC_DAC | ML_RECORD_PATH_MICL2LCH );
            break;
        case 1:// L internal R extrenal
            audio_ic_write( AUDIO_IC_PM3 | ML_LCH_MIXER_INPUT_SINGLE_INT | ML_RCH_MIXER_INPUT_SINGLE_EXT | ML_RECORD_PATH_MICR2RCH);
            audio_ic_write( AUDIO_IC_PM1 | ML_AUDIO_ENABLE_ADC_DAC | ML_RECORD_PATH_MICL2LCH );
            break;
        case 2:// LR external
            audio_ic_write( AUDIO_IC_PM3 | ML_LCH_MIXER_INPUT_SINGLE_EXT | ML_RCH_MIXER_INPUT_SINGLE_EXT | ML_RECORD_PATH_MICR2RCH);
            audio_ic_write( AUDIO_IC_PM1 | ML_AUDIO_ENABLE_ADC_DAC | ML_RECORD_PATH_MICL2LCH );
            break;
        case 3:// L internal R balranced (used for test)
            audio_ic_write( AUDIO_IC_PM3 | ML_MIC_IF_CTL_DIFFER | ML_RECORD_PATH_MICR2RCH); //0x11
            audio_ic_write( AUDIO_IC_PM1 | ML_AUDIO_ENABLE_ADC_DAC | ML_RECORD_PATH_MICL2LCH );
            break;
        case 5:// External mono left
            audio_ic_write( AUDIO_IC_PM3 | ML_LCH_MIXER_INPUT_SINGLE_EXT | ML_RCH_MIXER_INPUT_SINGLE_EXT | ML_RECORD_PATH_MICL2RCH);
            audio_ic_write( AUDIO_IC_PM1 | ML_AUDIO_ENABLE_ADC_DAC | ML_RECORD_PATH_MICL2LCH );
            break;
        case 6:// External mono right
            audio_ic_write( AUDIO_IC_PM3 | ML_LCH_MIXER_INPUT_SINGLE_EXT | ML_RCH_MIXER_INPUT_SINGLE_EXT | ML_RECORD_PATH_MICR2RCH);
            audio_ic_write( AUDIO_IC_PM1 | ML_AUDIO_ENABLE_ADC_DAC | ML_RECORD_PATH_MICR2LCH );
            break;
        }


Yep, I added myself two possibilities of external left and right channel mono, but this I want to discuss later :)

What I want to discuss here is cleanup of this code. If that will be approved (it has chances to be included in main repo), i'm thinking about doing following things:
- Move all controller-specific constants from audio.h to audio-ak.h and audio-lapis.h, as they differs due to registers.
- Cleanup audio-ak.c to have one style of coding
- Where possible, replace hardcoded values with constants, like in my example code, that is based on how audio-lapis.c looks (it's much more human-readable this way)
- Add comments about functions of each register used, as at least in ak4646 they are mixed.
- Optional: Add "external mono left" and "external mono right" - they are useful also when you have eg. xlr to stereo jack cable connected to mono microphone, or have y-adapter with two mics each on own channel, and want to select it (already tested by me on 5d2 and works ok)

But of course I need approval so I don't waste my time :), and some suggestions if there are some internal rules of how code should look like.



#403
Ok, now I know that 5d2 uses "old" audio chip, and audio-ak.c that is poorly documented. On this controller, inputs are set using pm3 register
    int pm3[] = { 0x00, 0x05, 0x07, 0x11 }; //should this be in a header file?
/* few lines later */
    audio_ic_write( AUDIO_IC_PM3 | pm3[input_source] );


but as those values are hardcoded without comment, I have no idea what other values are possible.

[edit]
Ok, with help of AK4646 datasheet I was able to rewrite a code a bit to meet audio-lapis.c style (#define, etc) and add two additional options: External mono left and External mono right.
No luck with swaping behavior of L:int, R:ext, as internal microphone seems to be connected only to left internal channel (no signal at all on right internal), but by looking at the original code, it was already coded like this.
Also, when I switch right (broken) channel to internal, this 100% signal disappears, so I need to trace problem once again, since it lies between connector and audio controller itself.
#404
My 5d2 has broken right channel. It has 100% signal all the time. It's issue between audio controller and digic, as i checked circuit from socket to controller and it's ok.
That creates annoying effects while editing files on pc, and also makes "L:int, R:ext" option useless for me.

I looked into source code, in audio-lapis.c there's function audio_ic_set_input(int op_mode)
Am I right, that to invert this behavior (use R:ext and internal on R) all I need to change is
case 1:// L internal R extrenal
            audio_ic_write(ML_RCH_MIXER_INPUT | ML_RCH_MIXER_INPUT_SINGLE_HOT); // replace with SINGLE_COLD
            audio_ic_write(ML_LCH_MIXER_INPUT | ML_LCH_MIXER_INPUT_SINGLE_COLD); // replace with SINGLE_HOT
            audio_ic_write(ML_RECORD_PATH | ML_RECORD_PATH_MICL2LCH_MICR2RCH); //
            audio_ic_write( ML_MIC_IF_CTL | ML_MIC_IF_CTL_ANALOG_SINGLE );
            break;

?

Also, as "L internal R extrenal" requires microphone power, is it possible to modify "External stereo" to work as mono (both channels left, or at least mute right channel)?
#405
Camera Emergency Department / Re: 70D will not boot
June 22, 2015, 02:42:56 PM
Are you using battery grip? Is card that you used for display test bootable?
For now, looks like a hardware issue.
#406
Raw Video / Re: Huge Problem with 50D aperture
June 17, 2015, 09:25:06 PM
QuoteI just deleted the bootflag and inserted a cf card without magic lantern installed. If I now press the rec button the movie recording starts. Guess this shouldnt be. I think there is some software error.
I have a friend with exactly the same "anomaly". Is this related to how ML enables recording function in 50d, or something interesting to investigate?
#407
Quote from: dmilligan on May 30, 2015, 05:15:35 PM
No, this sounds quite different.

Yep, but check log OP attached, there's definitely ERR70.

@ruttiebar - can you check on external HDMI display/analog one? Have you tried booting camera on each dial mode?
#408
Quote1604: 54362.854 [MC] Disp Error : 70
Look for ERR70 on this forums. Probably some prop was set wrong. I think you will probably need to wait for A1ex for help.
#409
Have you ever used MagicLantern on this exact camera before this happend?
#410
I compared logs from 60D with mine, and while your looks even more detailed, it fails somewhere there:

   Startup:ff860c28:82:02: DispConEmergencyStop (PUB)
   Startup:ff963d48:19:03:  (PUB) UnlockImagePlayDiriver
   Startup:ff963da0:19:03:  SetLockState 321
   PropMgr:ff86a500:00:01: [PM] DisablePowerSave (Counter = 2)
   PropMgr:ff86a570:00:01: [PM] EnablePowerSave (Counter = 1)
**INTERRUP:ff86a500:00:01: [PM] DisablePowerSave (Counter = 2)
**INTERRUP:ff86a570:00:01: [PM] EnablePowerSave (Counter = 1)
  MainCtrl:ff820eb8:9c:01: ID:80010000(0)
**INTERRUP:ff86a500:00:01: [PM] DisablePowerSave (Counter = 2)
**INTERRUP:ff86a570:00:01: [PM] EnablePowerSave (Counter = 1)
   PropMgr:ff81f050:89:03: PROP_PERMIT_ICU_EVENT (SW = 1, 1)
**INTERRUP:ff86a500:00:01: [PM] DisablePowerSave (Counter = 2)
**INTERRUP:ff86a570:00:01: [PM] EnablePowerSave (Counter = 1)
   PropMgr:ff822ad8:85:03: GUI_Control:42 0x0
   PropMgr:ff822ad8:85:03: GUI_Control:43 0x1
  MainCtrl:ff820eb8:9c:01: ID:80030023(1)
  MainCtrl:ff87777c:9c:16: Disp Error : 50


DispConEmergencyStop (PUB) is in both logs. Just after UNlockImagePlayDiriver, there's "SetLockState", call I can't find in 60d log.
#411
The joke is that CFast is just smaller from-factor SATA disk with different connector, so this guy is trying to sell adapter that has two connectors, cables and maybe a few elements for voltage stabilization for $500. And of course such adapters exists for less than 100 USD (still overprinced for me). That's why it works, and why situation is completely different between SATA/ATA <> CF.

#412
50D with 5d2 card shows warning on LCD that camera is wrong model. 50d in 5d2 ends with black screen and blinking led, in both cases I need to remove card and battery, and it will start without card or with proper version of ML installed.
#413
Now, full log: http://pastebin.com/Zx1fhWuh
Line 2068:  DispConEmergencyStop (PUB)
#414
I think I found it: loc_ff06709c (by comparing to 5D2 code, called in another function 2 instructions before string "[JOB ERROR] GetJobID failed"
Left - "known" 5D2, right is 50D


I got dm.log: http://pastebin.com/RC0pAdpE
Is it OK?
#415
Ok, took me a bit more, I just replaced 550d with 5d2 so I have a new toy to play with ;)

About GetTaskName, as I don't see it in stubs.S, I understand that I need to find it using this method?
#416
I don't have time right now to compile stuff, but yes, I'm able to do this :)
It's laying on my desk since 6 months now so can wait another week. I'll post results when I find some time.
#417

My broken ERR50 50D
#418
Link to download from first post does not work. Nslookup says that upload.g3gg0.de does not exist in dns (g3gg0.de does)
#419
I *might* be able to help a little.
Long time ago (well, very long: http://pdasite.pl/kitor/maui_linux/, half of site is not working now) I was able to port Linux kernel to some unsupported PDA. The fact is that there existed one that was supported and similar hardware-wise, but it still it involved looking for gpios, etc.
I have half-dead 50d (err50, but it has bootflag enabled), also one burned motherboard (doesn't power on). I don't have right now access to hotair rework station, but I should have in two-three weeks - I'll clean this damaged board from all elements and try to at least partially recreate gpio map. Of course if that wasn't done before.
#420
30D no luck (so I guesss signature is bad)
#421
Yep, the card must be prepeared for "normal" MagicLantern boot, you just replace autoexec on working card.
@alex - I'll try on 30D tomorrow.
#422
ML is hacking it's way around Canon's code running on camera. By running own kernel/operating system (and if hardware will be well understood to write drivers for all devices), ML won't need DryOS hacking anymore.
Features like raw recording or full-res silent pictures are hacks running on top of Canon's code. This way it would be possible to implement them clean way, as we will have direct access to hardware.
Also (I believe) there were some features that was possible to implement, but were not implemented if they existed in "better" camera models. By running everything Linux based, Canon won't have any rights to interfere in ML development (in theory even if they decide to work on 1dx/dc ;) ).

BTW: Is it possible to build test binary for 30D? I'd like to try on this unsupported camera, if possible :)
#423
Another 550d, but better quality ;)
#424


550d. Later I'll try on my ERR50 50D (I must find cf card)
#425
I've done similar mod with kit 18-55 lens connected to FF. It works from approx 20mm without hitting mirror, and covers almost full frame (rounded edges) on 18mm. But I'm using it with old analog EOS 650 (even AF works  :o ) so I can't check crop mode.