650D dual_ISO isoless PH err(2)

Issue #1781 open
Yu huang created an issue

problem: dual iso always come to this err,can't work normally
I'am using latest ML on my 650D. sometimes when i turned on the dual iso module,a
isoless PH err(2) shown. But if i turn the camero up and down serveral times,It can disapear.
I've look into the dual_iso module's code,and found that this is because the
isoless_enabal function ,the var flag not equal to CMOS_EXPECTED_FLAG. but,
the given params should aways be the same,how can this happen?
uint32_t flag = raw & CMOS_FLAG_MASK;
int iso1 = (raw >> CMOS_FLAG_BITS) & CMOS_ISO_MASK;
int iso2 = (raw >> (CMOS_FLAG_BITS + CMOS_ISO_BITS)) & CMOS_ISO_MASK;
int reg = (raw >> 12) & 0xF;

        if (reg != 0 && !is_6d)
            return reg;

       ** if (flag != CMOS_EXPECTED_FLAG)**
            return 2;

Comments (31)

  1. Alex

    The meaning of CMOS_EXPECTED_FLAG is not really understood; these checks are to make sure the address is correct (so instead of patching the memory blindly, it should fail without changing who knows what setting).

    If you can compile ML, can you try to print the contents of memory from start_addr, count*size bytes when it fails?

  2. Yu huang reporter

    I now know what the code mean,And i can compile dual_iso.mo.
    But I don't know how to write the value to a file on the sdcard ,is there any way to do so?thanks a lot

  3. Alex

    Yeah, with classic file i/o, you can try FIO_CreateFileEx, my_fprintf, FIO_CloseFile.

    I use console_printf; for that, you need to define CONFIG_CONSOLE at the top of dual_iso.c (before includes), and also define CONSOLE_DEBUG in console.c. The messages will be saved to console.log.

  4. Yu huang reporter

    I've tried that:
    1: in dual_iso.c : define CONSOLE_CONFIG before includes & include <console.h>
    2: in console.c :change the #undef CONSOLE_DEBUG to #define CONSOLE_DEBUG
    recompile the dualiso.mo,but i only can see the log from the screen after change set
    in menu,there is non file in the ML/Logs/console.log
    so,I want to see the full output from screen,but it's width is too short,I can't see the value

  5. Yu huang reporter

    sorry, I start to touch this today,I know make 650D,but I don't know how to pack files should be put in SDcard

  6. Yu huang reporter

    I've tried my best to do. I compile the 650D's zip file out,but it can't boot normally.
    the code was the newest in bitbuket unified branch(to make sure i even hg clone from start) and the i changed the console.c to define CONSOLE_DEUG and dual_iso.c
    and then make zip ,but there are too many model's the makefile wantto build ,so I
    changed the SUPPORTED_MODELS= 650D to only compile 650D's , but an error occured like "../50D.xxx/magiclantern.bin" not found, so i just do "touch magiclantern.bin" in every model folder in platform expect 650D.104.Then no error,
    i unarchive the zip file in my sdcard and overwrite the old file , and it can't boot,just
    a black screen. I wonder know what's wrong

  7. Yu huang reporter

    when a PH err(2) occoured,I got the fllowing data:

      0: 0x4049f144 0x0
      1: 0x4049f154 0x4626
      2: 0x4049f164 0x0
      3: 0x4049f174 0x4626
      4: 0x4049f184 0x0
      5: 0x4049f194 0x4626
    

    this is generated by add

                        for(int i=0;i<count;i++)
                        {
                            raw = *(uint16_t*)(start_addr + i * size);
                            console_printf("%d: 0x%x 0x%x\n",i,start_addr+i*size,raw);
                        }
    

    to the if(flag!=CMOS_EXPECTED_FLAG)

  8. Alex

    This doesn't look like ISO register values.

    Can you do something a little more advanced?

    • enable CONFIG_GDB=y in Makefile.user
    • recompile ML (run "make clean" first)
    • compile the adtg_gui module and load it
    • in the ADTG registers menu, take a look at CMOS[0] address (should be something from the list you printed). The address might be different when it fails.

    If it's different, I think we have to find a pointer to it somewhere in RAM.

  9. Yu huang reporter

    I already recompiled the firmware use CONFIG_GDB = y and enable the adtg_gui module in camera,but i don't know how to see the register's value . could you please
    give me some more information?

  10. Yu huang reporter

    OK,I done it . the information about cmos[0] is

    CMOS[0] 0x803 Addr=4049f244 value=2051(0x803),nrzi=4093(0xffd)
    
  11. Alex

    This is for ISO 100, right?

    Now, if you set PHOTO_CMOS_ISO_START to 0x4049f244, the pattern probably changes, right? (that is, when it worked before, now it would say error, and when it failed before, now it would work).

    Can you find a pattern when it chooses one address and when the other? (for example, starting in certain modes... I don't know)

    A simple hack would be some sort of autodetection function (scan around this address for certain memory contents). A pointer would be preferred, but I'm not sure where to start searching (other than dumping the entire RAM and searching blindly there).

  12. Yu huang reporter

    I found that in most case the cmos[0] addrs is 4049f244 and the value
    change to smaller than 0x807 like 0x806 make sense in do dual_iso

  13. Alex

    Maybe it can work, but I've seen this report on other cameras too (EOS M iirc), so it may be better to find something a little more generic.

  14. Yu huang reporter

    I add a function

    //is_address_right must use after all other value setted
    //despite the FRAME_CMOS_START and PHOTO_CMOS_START
    //return 1  means true, 0 meas false
    static uint8_t is_address_right(uint32_t address,uint16_t count,uint16_t size,uint16_t expected,char *model)
    {
        if(streq(model,"650D"))
        {
            for(uint i=0;i< count;i++)
            {
                uint16_t raw=*(uint16_t *)(address+i*size);
                uint32_t flag= raw & 0x3;
            //if start_addr is right,all flag will be 11
            //else raw is 0x0 0x4046,flag is 0x0 or 0x10 bad address
                if(flag != expected)
                    return 0;
            }
            return 1;
    
        }
        else
        {
            return 0;
        }
    }
    

    and put the start address' setting at end of the init

             *100 0x803 0x4049f144 or 244   
             *200 0x827 0x4049f154          0x24
             *400 0x84b 0x4049f164          0x24
             *800 0x86f 0x4049f174          0x24
             *1600 0x893 0x4049f184         0x24
             */
            is_650d = 1;    
    
            uint32_t photo_cmos_start_set[]={0x4049f144,0x4049f244};
            uint32_t frame_cmos_start_set[]={0x404a038e,0x404a048e};
            FRAME_CMOS_ISO_COUNT =          6;
            FRAME_CMOS_ISO_SIZE  =       0x22;
    
            PHOTO_CMOS_ISO_COUNT =          6;
            PHOTO_CMOS_ISO_SIZE  =       0x10;
    
            CMOS_ISO_BITS = 3;
            CMOS_FLAG_BITS = 2;
            CMOS_EXPECTED_FLAG = 3;
    
            //determin the PHOTO_CMOS_ISO_START VALUE
            if(is_address_right(photo_cmos_start_set[0],PHOTO_CMOS_ISO_COUNT,PHOTO_CMOS_ISO_SIZE,CMOS_EXPECTED_FLAG,camera_model_short))
            {
                PHOTO_CMOS_ISO_START = photo_cmos_start_set[0];
            }
            else
            {
                PHOTO_CMOS_ISO_START = photo_cmos_start_set[1];
            }
            //determin the FRAME_CMOS_ISO_START VALUE
            if(is_address_right(frame_cmos_start_set[0],FRAME_CMOS_ISO_COUNT,FRAME_CMOS_ISO_SIZE,CMOS_EXPECTED_FLAG,camera_model_short))
            {
                FRAME_CMOS_ISO_START=frame_cmos_start_set[0];
            }
            else
            {
                FRAME_CMOS_ISO_START=frame_cmos_start_set[1];
            }
    
  15. One Percent

    EOSM the regs changed based on boot method as well. I found dual ISO stopped working when I used copy+restart or booted into a different memory area.

  16. Victor Naumik

    The behavior is still reproducible. Maybe that temporary fix can be placed for now before a normal solution is found?

  17. Log in to comment