AB1805 Li and Library

I am having a bit of difficulty understanding the datasheet for AB18X5 and therefore the library and reference design for AB1805 with a Lithium battery.

The confusion and what appears to not be working is FOUT to D8.

I have built the V1 featherwing and this passes the hwtest.cpp sketch. If I try the periodic-wake.cpp it doesn't work.

Looking at the top of AB1805_RK.cpp I can see this

// Define SET_D8_LOW on FeatherAB1805v1 boards as the pull-up is wired to 3V3R instead

// of 3V3 which can cause current leakages when powering down using EN.

#define SET_D8_LOW

However, on the schematic there is no pull-up to 3V3R? There is no pinMode for FOUT/D8 with INPUT_PULLUP.

The D8/FOUT connection is only used if waking from hibernate sleep using the AB1805 RTC, as the nRF52 RTC does not run in hibernate sleep mode. If you're not using that feature, you really don't need the D8 connection.

The comment was referring to the FeatherAB1805 (not -Li or -SC). In FeatherAB1805 v1, the D8 pull-up was to 3V3R, but this caused current leakage. In FeatherAB1805 v2 there's 100K hardware pull-up to 3V3 which does not have current leakage.

In FeatherAB1805-Li, there isn't a hardware pull-up at all. This is OK because when you specify a wake source on a GPIO on either rising or falling, an MCU pull is enabled on the pin, eliminating the need for a hardware pull-up.

The hardware pull-up could have been removed on all designs, but I didn't do that.

Rick

Thanks for your reply. Iā€™m still unclear.

I have the following use case - RTC with battery backup and hardware watchdog both must have requirements. Should have is the ability to set an alarm that will allow the P2 to receive an interrupt and handle it - i.e. start or stop a process.

I am trying to explore the alarm functionality but not making progress - if there is a board issue i.e. AB1805 pin to D8 connection then would this manifest with the test sketch. The register values I am seeing are different from the examples in the sketch - since there is no description I have no way to understand if this is significant. Thanks

What are the log messages?

I think you need to comment out the define of SET_D8_LOW. It should have been commented out in the library, but I apparently forgot to after testing.

Update: I released version 0.0.2 with the define disabled by default.

Thanks - will try that and let you know outcome.

Here is the log with SET_D8_LOW commented out

0000007399 [app] INFO: Serial connected
0000015000 [app] INFO: Scanning I2C bus...
0000015026 [app] INFO: AB1805 found at address 0x69
0000015041 [app] INFO: 1 devices found
0000015051 [app] INFO: running chipTest
0000015061 [app] INFO: regAddr=28 value=18
0000015073 [app] INFO: regAddr=29 value=05
0000015084 [app] INFO: regAddr=2a value=13
0000015095 [app] INFO: regAddr=2b value=47
0000015106 [app] INFO: regAddr=2c value=b9
0000015117 [app] INFO: regAddr=2d value=85
0000015128 [app] INFO: regAddr=2e value=cc

Does this appear to be correct?

Those seem reasonable. The registers are:

    static const uint8_t REG_ID0                    = 0x28;      //!< Part number, upper (read-only)
    static const uint8_t   REG_ID0_AB08XX           = 0x18;      //!< Part number, upper, AB08xx
    static const uint8_t   REG_ID0_AB18XX           = 0x18;      //!< Part number, upper, AB18xx
    static const uint8_t REG_ID1                    = 0x29;      //!< Part number, lower (read-only)
    static const uint8_t   REG_ID1_ABXX05           = 0x05;      //!< Part number, lower, AB1805 or AB0805 (I2C)
    static const uint8_t   REG_ID1_ABXX15           = 0x05;      //!< Part number, lower, AB1815 or AB0815 (SPI)
    static const uint8_t REG_ID2                    = 0x2a;      //!< Part revision (read-only)
    static const uint8_t REG_ID3                    = 0x2b;      //!< Lot number, lower (read-only)
    static const uint8_t REG_ID4                    = 0x2c;      //!< Manufacturing unique ID upper (read-only)
    static const uint8_t REG_ID5                    = 0x2d;      //!< Manufacturing unique ID lower (read-only)
    static const uint8_t REG_ID6                    = 0x2e;      //!< Lot and wafer information (read-only)

It's fully expected that 2b, 2c, 2d, and 2e will be different because the lot number and unique ID will almost certainly be different from when I ran the self-test on my chip.

Hi @rickkas7 I am back testing the AB1805 Li and library.
Using the example selftest4 software the following test fail:

        // Set an interrupt in 30 seconds
        ab1805.interruptCountdownTimer(30, false);

        SystemSleepConfiguration config;
        config.mode(SystemSleepMode::HIBERNATE)
            .gpio(D8, FALLING);
        System.sleep(config);

        // System should reset here
        Log.error("TEST_HIBERNATE_30 failed");
        testNum = 0;
        break;

The log output is like this:

0000060649 [app.ab1805] INFO: setWDT 0
0000060664 [app] ERROR: TEST_HIBERNATE_30 failed

The other tests TEST_STOP_30:, TEST_ALARM_30:, TEST_REPEAT_60: and TEST_REPEAT_60_RUN: all fail.

Can you suggest why these fail please?

My guess is that the pull-up really is required. It's on the other boards, but not the AB1805-Li test board. If you can temporarily wire a 10K pull-up from D8 to 3V3 it would be interesting to see if that fixes the problem. You could also try setting pinMode(D8, INPUT_PULLUP).

Thanks - will try that.

Another question - should D8 really use D10 if the AB1805 is to wake the P2 from stop/hibernation? Or can Photon equivalent of WKP be on any pin?

If you are using stop or ULP sleep you can wake on any pin on RTL872x. If you are using hibernate sleep you can only wake on D10. On the Photon 2, D10 is in the same physical position as D8 on the Boron and Argon but you would need to update the code to use D10.

Also I just remembered that on the P2/Photon 2, in hibernate sleep, RTL872x does not support software pull-ups on D10, so if the hibernate wake tests will fail unless you add an external pull-up to 3V3.

So I just put a 10K between D8 and 3V3 as you suggested.

Test 3 still fails -

SystemSleepConfiguration config;
        config.mode(SystemSleepMode::HIBERNATE)
            .gpio(D8, FALLING);
        System.sleep(config);

It Is not putting the P2 into hibernation?

Test 4 still fails because it does stop but then the timer wake never happens. Pressing reset correctly restarts it.

I just realised that the pin for wake that the feather uses is D10 not D8 - I changed D8 to D10 and ... working.

You need to change the D8 in the code to D10 on the Photon 2.

I have done that and it now works - maybe you want to update the library?

1 Like

Yes, I'll switch it to WKP, which is D8 on the Argon/Boron and D10 on the Photon 2.

1 Like

Updated the design files for FeatherAB1805-Li to add a missing pull-up resistor that would affect using it with the Photon 2 for wake from hibernate sleep. Also fixed the code to use WKP instead of hardcoding D8, since WKP is D10 on the Photon 2.

@rickkas7 Top service - I have tested all the options - observation is that the timing (alarm) isn't that accurate - I intend to try some more controlled tests.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.