Datalogger not working with power supply

Hello,

i have Leonardo, Wireless Shield and Accessory Shield for Bluno.

Datalogger worked with USB cable (data was written in microSD), but not power supply. Why?
Does SD need Serial?

My code

#include <SD.h>
#include "blunoAccessory.h"
blunoAccessory myAccessory;

float h,t;

const int chipSelect = 4;

void setup() {
  myAccessory.begin();
  h = myAccessory.readHumidity();
  t = myAccessory.readTemperature();
    
  if (!SD.begin(chipSelect)) {
    return;
  }
}

void loop() {	

  File dataHumidity = SD.open("Humidity.txt", FILE_WRITE);
  File dataTemp = SD.open("Temp.txt", FILE_WRITE);

  if (dataHumidity) {
    dataHumidity.println(h);
    dataHumidity.close();
    
    if (dataTemp) {
      dataTemp.println(t);
      dataTemp.close();      
    }
  }
 delay(1000);
}