on this line: while ((timeout--) && (!(status() & BQ27441_FLAG_CFGUPMODE))) status() should be replaced with flags() correct line: while ((timeout--) && (!(flags() & BQ27441_FLAG_CFGUPMODE))) please fix, thanks.