Camera demo stuck on read_pclk

I have my first Edge board and am trying to use the camera. The HM01B0 demo is stalling at the first read_pclk call in hm01b0_blocking_read_oneframe(). My compile/load output is below. I added printfs to main.c and HM01B0.c (attached). The terminal emulator fills up with lower case ‘p’ as shown in the code snip. I tried turning the camera connection over, and it acts exactly the same. It is now plugged in with the lens down, towards the battery holder. There is no battery - the board is running off the standard USB-serial board with the default jumper setting for 3v3. I am following instructions here:

https://learn.sparkfun.com/tutorials/us … o3-sdk/all

What could the problem be? Where would I start poking with a 'scope?

uint32_t hm01b0_blocking_read_oneframe(hm01b0_cfg_t *psCfg, uint8_t *pui8Buffer, uint32_t ui32BufferLen)
{
    uint32_t    ui32Err         = HM01B0_ERR_OK;
    uint32_t    ui32Idx         = 0x00;

    am_util_stdio_printf("[%s] +\r\n", __func__);

    uint32_t    ui32HsyncCnt    = 0x00;

    while((ui32HsyncCnt < HM01B0_PIXEL_Y_NUM))
    {
        am_util_stdio_printf("%d:", ui32HsyncCnt);
        while (0x00 == read_hsync())
        {
            am_util_stdio_printf(".");
        }
        am_util_stdio_printf(" hsync-done ");
        // read one row
        while(read_hsync())
        {
            am_util_stdio_printf("r");
            int preps = 0;
            while(0x00 == read_pclk())
            {
                if (0 == (preps++ & 0x00000FFF))
                {
                    am_util_stdio_printf("p");                     // <<<<< STUCK HERE
                }
            }

            *(pui8Buffer + ui32Idx++) = read_byte();
            am_util_stdio_printf("0x%02x ", *(pui8Buffer + ui32Idx - 1));
            if (ui32Idx == ui32BufferLen) {
                goto end;
            }
            while(read_pclk())
            {
                am_util_stdio_printf("P");
            }
        }

        ui32HsyncCnt++;
    }

end:

    am_util_stdio_printf("[%s] - Byte Counts %d\r\n", __func__, ui32Idx);

    return ui32Err;

}
Makefile:110: warning: you have not defined COM_PORT. Assuming it is COM4
Makefile:114: warning: you have not defined PYTHON3. assuming it is accessible by 'python3'
Makefile:118: defaulting to 115200 baud for ASB
Makefile:122: defaulting to 921600 baud for SVL
Makefile:127: warning: you have not defined SDKPATH so will continue assuming that the SDK root is at ../../../../..
Makefile:135: warning: you have not defined COMMONPATH so will continue assuming that the COMMON root is at ../../../../common
Makefile:143: warning: you have not defined BOARDPATH so will continue assuming that the BOARD root is at ../../..
Makefile:151: warning: you have not defined PROJECTPATH so will continue assuming that the PROJECT root is at ..
Cleaning...
Makefile:114: warning: you have not defined PYTHON3. assuming it is accessible by 'python3'
Makefile:122: defaulting to 921600 baud for SVL
Makefile:127: warning: you have not defined SDKPATH so will continue assuming that the SDK root is at ../../../../..
Makefile:135: warning: you have not defined COMMONPATH so will continue assuming that the COMMON root is at ../../../../common
Makefile:143: warning: you have not defined BOARDPATH so will continue assuming that the BOARD root is at ../../..
Makefile:151: warning: you have not defined PROJECTPATH so will continue assuming that the PROJECT root is at ..
 Compiling gcc ../../../../common/examples/hm01b0_camera_uart/main.c
 Compiling gcc ../../../../common/tools_sfe/templates/startup_gcc.c
 Compiling gcc ../../../../common/third_party/hm01b0/HM01B0.c
 Compiling gcc ../../../../../utils/am_util_stdio.c
 Compiling gcc ../../../../../utils/am_util_delay.c
 Linking gcc ../gcc/bin/hm01b0_camera_uart_asb.axf with script ../../../../common/tools_sfe/templates/asb_linker.ld
 Copying gcc ../gcc/bin/hm01b0_camera_uart_asb.bin...
python3 ../../../../common/tools_sfe/asb/asb.py --bin ../gcc/bin/hm01b0_camera_uart_asb.bin --load-address-blob 0x20000 --magic-num 0xCB -o ../gcc/bin/hm01b0_camera_uart --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 921600 -port /dev/ttyS19 -r 2 -v
Header Size =  0x80
original app_size  0x5758 ( 22360 )
load_address  0xc000 ( 49152 )
app_size  0x5758 ( 22360 )
w0 = 0xcb0057d8
Security Value  0x10
w2 =  0x10008080
addrWord =  0xc000
versionKeyWord =  0x0
child0/feature =  0xffffffff
child1 =  0xffffffff
crc =   0xc02f5e1
Writing to file  ../gcc/bin/hm01b0_camera_uart_OTA_blob.bin
testing: ../gcc/bin/hm01b0_camera_uart_OTA_blob.bin
Header Size =  0x60
app_size  0x57d8 ( 22488 )
Writing to file  ../gcc/bin/hm01b0_camera_uart_Wired_OTA_blob.bin
Image from  0x0  to  0x57d8  will be loaded at 0x20000
Connecting over serial port /dev/ttyS19...
Sending Hello.
Received response for Hello
Bootloader connected
Received Status
length = 0x58
version = 0x5
Max Storage = 0x4ffa0
Status = 0x2
State = 0x7
AMInfo =
0x1
0xff2da3ff
0x55fff
0x1
0x4cd00005
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
Sending OTA Descriptor = 0xfe000
Sending Update Command.
number of updates needed = 1
Sending block of size 0x5838 from 0x0 to 0x5838
Sending Data Packet of length 8180
Sending Data Packet of length 8180
Sending Data Packet of length 6224
Sending Reset Command.
Tries = 0
Upload complete!

HM01B0.zip (8.73 KB)

…did you be sure to use the NONpre-compiled binaries? https://learn.sparkfun.com/tutorials/pr … or-success

No, but thanks for the pointer to that page. It shows the proper orientation of the camera, so I have that much right. I’m not using the Arduino GUI because I didn’t want to learn it. I’m following command line instructions here:

https://learn.sparkfun.com/tutorials/us … pollo3-sdk

This project does not seem to link tensorflow, or get far enough to use it if it were there. It’s just the Edge board camera demo, stuck on reading the first frame:

\AmbiqSuiteSDK-master\boards_sfe\edge\examples\hm01b0_camera_uart\gcc

Sources are:

SRC=

SRC+= main.c

SRC+= startup_gcc.c

SRC+= HM01B0.c

SRC+= am_util_stdio.c

SRC+= am_util_delay.c

SRC+=

All those objects, and only those objects, are in my BIN folder. No reasonable substring of “tensorflow” exists in the Makefile or the make output above.

read_pclk() looks like a check for bit 23 of register RDA to be clear, which never seems to happen. It would not get there unless bit 22 were set. It passes the second check, for bit 23 set. So the bits are probably all set. After putting an escape count in the wait loop to see what happens next, read_byte() (APBDMA->BBINPUT) seems to be returning ‘B’ (0x42) every time.

Is there another way to check camera function? The board seems ok - UART commo is fine until the camera routine gets stuck.

Actually I think this console output captures the problem. GetModelId returns an I2C error and a null model number:

HM01B0 Demo
 SCL:   Pin 8
 SDA:   Pin 9
 MCLK:  Pin 26
 VSYNC: Pin 15
 HSYNC  Pin 27
 PCLK:  Pin 7
 D0:    Pin 14
 D1:    Pin 11
 D2:    Pin 25
 D3:    Pin 34
 D4:    Pin 6
 D5:    Pin 5
 D6:    Pin 35
 D7:    Pin 28
Apollo3 Burst Mode is Available
Apollo3 operating in Normal Mode (48MHz)
Apollo3 operating in Burst Mode (96MHz)
HM01B0 Model ID 0x0000, rc 0x1

where the rc 0x01 is an I2C error in HM01B0.h:

enum
{
    HM01B0_ERR_OK               = 0x00,
    HM01B0_ERR_I2C,
    HM01B0_ERR_MODE,
    HM01B0_ERR_AE_NOT_CONVERGED,
};

Turning off burst mode did not help. There is no 1.8 VDC on pin 10 of the camera connector, counting from either side. I think pin 1 must be near mic0, since pin11 counting from there had 3.1 VDC. I’m pretty sure pin 10 had about 400 mV on it, but my probes are twice the size of the pin repeat.

U3 is only putting out 1.1VDC with the camera connected. With the camera out, it’s 0 VDC. I’m measuring on pin 6 assuming 5 is the empty spot. It’s shorted to what I think is pin 10 on the camera header.

Did I pull a bad camera, loading down the supply?

I threw a second camera into my last Digikey order. This one is getting a little further. Model ID comes up 0x01B0 with rc==0, so I2C is happy. Now the software hangs up higher in HM01B0.c:hm01b0_blocking_read_oneframe(). hsync is always zero now, so this line stops execution:

while (0x00 == read_hsync());

U3.6 is still just 1.1 VDC with the camera in place and 0VDC with the camera unplugged.

Any ideas from the experts?

If I think of an idea I’ll be sure to post it :-/

Maybe try cross-posting in the Ambiq forums too?