ATtiny1616 -> VLM Fairly Broken?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Depending on what source is used (a few are attached), and which version, the Attiny1616 might support the following levels -

 

typedef enum BOD_LVL_enum
{
    BOD_LVL_BODLEVEL0_gc = (0x00<<0),  /* 1.8 V */
    BOD_LVL_BODLEVEL1_gc = (0x01<<0),  /* 2.1 V */
    BOD_LVL_BODLEVEL2_gc = (0x02<<0),  /* 2.6 V */
    BOD_LVL_BODLEVEL3_gc = (0x03<<0),  /* 2.9 V */
    BOD_LVL_BODLEVEL4_gc = (0x04<<0),  /* 3.3 V */
    BOD_LVL_BODLEVEL5_gc = (0x05<<0),  /* 3.7 V */
    BOD_LVL_BODLEVEL6_gc = (0x06<<0),  /* 4.0 V */
    BOD_LVL_BODLEVEL7_gc = (0x07<<0),  /* 4.2 V */
} BOD_LVL_t;

I have some boot-up code which uses the BOD and VLM to wait for voltage to rise. I can't rely on BOD alone as the chip is responsible for the process which raises the voltage. What I do is set the BOD at the lowest level and VLM at +25% and when VLM is met I raise the BOD to the next level.

// BOD
#define BOD_RESET_LEVEL BOD_LVL_BODLEVEL5_gc
#define BOD_RESET_PERCENT BOD_VLMLVL_15ABOVE_gc
#define BOD_VLM_STATUS_BAD BOD.STATUS


    // the voltage should be rising if AC, otherwise power could be coming from reverse USB-C
    // this increases the BOD as the voltage rises
    BOD_VLMCTRLA = BOD_VLMLVL_25ABOVE_gc; // 25% (initially);
    _delay_us(1);
    uint8_t i = 0;
    while (1) {
        if (tasker.ops.tasks) {
            tasker.ops.tasks = 0;
            wdt_reset();
            if (! BOD_VLM_STATUS_BAD) {
                if (i < BOD_RESET_LEVEL) {
                    i++;
                    BOD_CTRLB = i << BOD_LVL_gp;
                } else {
                    break;
                }
            }
        }
        sleep_cpu();
    }
    BOD_VLMCTRLA = BOD_RESET_PERCENT; // 15%;
    
    // can be disabled now
    BOOTSTRAP_DISABLE;

 

What actually happens is the VLM keeps reporting a STATUS of 'good'. I end up at 2.8v instead of 3.7v+25%

Which leads me to think many of the VLM entries really aren't working after all?

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It may be an edge trigger rather than a level trigger.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That wouldn't make any sense, if the voltage gradually reduced you'd never know. :)

I've dumped the approach in favour for one of the internal comparators.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The CTRLB register is read-only. The only way to change BOD level is changing fuses. So your initial approach would never work.