ラベル SD card の投稿を表示しています。 すべての投稿を表示
ラベル SD card の投稿を表示しています。 すべての投稿を表示

2025年7月19日土曜日

Flex 6600のSD card交換

 v3.9.19にアップグレードしようとしたら、firmwareのアップデートの所でエラーが出て進めない。面倒なので、そのままv3.9.18で使っていながら、FlexのHelpDeskにサポート依頼。

久しぶりにTim Ellison(W4TME)が担当で回答があり、「症状からするとSD cardが壊れているので、無償で送るので交換するように」という事だったので、住所を連絡したら、3日ほどでFedExー>JPで到着。


時間が取れたので土曜日に本体開けてSD Cardの交換をしてみると、 最初はコールドスタートして、アンバー色のボタンを押すとグリーンの点滅、そして赤の点滅。 コールドスタートで、アンバー色のボタンを長押しすると薄い青(白色)の点灯、そして赤の点滅。 

いずれにせよ立ち上がらない! ググってみると同じような症状でファンが回っていないが、何度かリブートすると治った、等の報告が見られたが、釈然としない。 再度、HepDeskに書き込み(あ、向こうの土曜日! 明後日でないとダメかな?)と、土曜日に作業したことを悔やむ。

で、暇なので、再度SD Card周りを触って見てみると、 SD Cardのフォルダー(金属のクリップのようになっている)が結構緩い! SD Cardを適当と思われる位置に置いて、上からフォルダを押さえ、動かないように送られてきたカプトンのテープでフォルダ(SD Card)を固定して、電源を入れてみると、今度は暫くして、LEDがグリーンの点灯。ファンも回っている。


PCからSmartSDRでアクセスしようとするが、当該の機器が見つからない!と返ってくる。「あー、やっぱりHelpDesk行きかな?」と思い、電源を入れっぱなしにして(グリーンの点灯が維持されている状態を確認して)、10分ほど他の事をして、もう一度SmartSDRからアクセスしてみると、今度は無事アクセスでき、問題なく動作してくれている。

あ、プロフィルが消えているので、バックアップから読み込まないとプロファイル使えません(事前にプロファイルはPCにバックアップを取っておきましょう!) 

Timの説明によれば、送られてきたSD Cardにはfirmwareとライセンス内容(ブランク)が入っていて、最初に立ち上がるとFlexのライセンスサーバにインターネットで接続して、ライセンス内容を確認してダウンロード、SD Cardに書き込むようなので、ライセンス内容の取得(書き込み)に少し時間が係るようだ。 (新品であれば、SmartSDRがライセンスサーバにアクセスを誘導して、ライセンスの購入・取得をさせ、その後にその内容をFirmwareに書き込んで、使用できるようになっているらしい。 Flexにライセンスという概念がなかった時代から使用しているので、ここら辺がわかっていませんね。)

中は、テキサスの田舎とまでは言いませんが、結構広々と配置され、余裕の配置です。 また、筐体の上蓋を外すのに上面4本、側面5本づつ(10本)計14本のビスを外さないと開けられない、という、ちょっと量産製品ではない作りになっていました。 (ちなみに、底の方も側面は10本のビスで止められており、底板の所も何本かのビスで止められていると思われますが、今回は必要なかったので、開けておらず、調べてもいません)

 

2017年1月4日水曜日

ESP8266の利用 続き

土壌水分のリモート測定装置を作ろうとしていましたが、センサーの部分について少々問題があり挫折中。 で、取りあえずESP8266のADCを利用してデータを取得、基板上のLCDに表示して、更にデータをWiFi経由でサーバーに送る部分は使えるレベルのようなので公開することにします。
ESP8266のADCで0~1Vを1024の分解能で計測する事が出来ます。 ルーターのアドレス、パスワードやホストのURL等を後から変更できるようにSDカードで管理できるようにしてみました(セキュリティ上の問題がありますので、注意する必要があります) 。
ユニバーサル基板上に組んでいますが、専用の基板を起こせば、この半分くらいのサイズには出来ると思います。

疑問点;
 ESP8266のDeep Sleep modeで最大1時間程度のインターバルが出来るはずなのですが、うまく行きませんでした。 30分位が限界のようですが、何故?
  SD cardは最近の容量の大きいものは使用できません。大容量のSDカードに対応した(ファイル形式の異なる)スケッチが見つかりませんでした。 もっとも、この場合、大容量は要らないので、問題ではありませんが。

/* Sketch */

/*
 *
 *
 */
#include
extern "C" {
  #include "user_interface.h"
}
#include
#include
#include
#include

Sd2Card card;
ST7032 lcd;
const int chipSelect = 2;
// router情報、接続情報などのdefault値 port番号が固定(80)にしてあるので注意
char ssid[30]     = "?????";
char password[30] = "**********";
char Id[13] = "********";
char host[20] = "192.168.1.3";
const int httpPort = 80; 
boolean WiFiFlag = false;

// ESPのADCの生データを取得 データ変換は後で、、、 
uint tout_get(){
  uint ADC_Value = 0.0;
 count = 5;  // 5回計測して平均値を返す
  uint temp = 0;
  for(int i = 0; i < count; i++ ){
    ADC_Value = system_adc_read();
    Serial.println("===> " + String(ADC_Value));
    temp = temp+ADC_Value;
    delay(30); 
  }
  temp = temp/count;
  // Serial.println("ADC_Value = " + String(temp));
  return temp;
}
//  SSIDの指定されたファイル名のファイルの内容(文字列)を返す
char *read_sd(char* file) {
   // open the file for reading:
  File myFile = SD.open(file, FILE_READ);
  char *s0, *s1;
  s0 = s1;
  if (myFile) {
    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      *s1++ = myFile.read();
    }
    *s1 = '\0';
    // close the file:
    myFile.close();
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening " + file);
  }
  return *s0;
}

void setup() {
  Serial.begin(115200);
  delay(10);
#if 0
  // 自分のMAC addressの取得と表示
  byte mac_addr[6];
  WiFi.macAddress(mac_addr);
  char buff[20];
  Serial.print("Mac address: ");
  sprintf(buff, "%02X:%02X:%02X:%02X:%02X:%02X",
    mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
  Serial.println(buff);
#endfi
  // SDカード読み取りの初期化(設定)
  Serial.print("Initializing SD card...");
  if (!SD.begin(chipSelect)) {
    Serial.println("initialization failed!");
     // SD card無しでdefaultで動かすのなら、ここのコメントを取る
    // return; 
  }
  Serial.println("initialization done.");
  Serial.println("");
  Serial.println("Started");

 // SDカードの情報の読み込み
  ssid = read_sd("ssid.txt"); // WiFiルーターの名前
  password = read_sd("pass.txt"); // WiFi接続のためのpassword
  Id = read_sd("Id.txt");  // 本情報の識別のための任意の名前文字列
  host = read_sd("host.txt"); // HostのIPアドレス或いはURL
  delay(500); //Why?, but need this, otherwise WiFi cannot connect to

  // SSIDから取得した情報でWiFiと接続
  char *s = ssid;
  if(*s != '?' ){ 
    WiFi.begin(ssid, password);
    Serial.println("connecting to " + String(ssid) + " pass: " + String(password) );
    int i=0;
    while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
      i++;
    }
    WiFiFlag = true;  // When connection being made, then transmit data to WiFi, otherwise only to LCD.
    Serial.println("");
    Serial.println("WiFi connected"); 
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
  } else {
    WiFiFlag = false;
  }
  // LCDの初期化
  lcd.begin(8,2);
  lcd.setContrast(25);
  delay(40);
}
void loop() {
  String s1;
  int xx;
  // データ計測
  xx = tout_get();
  s1 =  String(xx) + " C"; //仮に温度だとして
  // LCDへの表示
  lcd.clear();
  lcd.setCursor(2,0);
  lcd.print(s1);
  Serial.println(" ====  Temp = " + s1 );
  // WiFiでHostに接続してデータ送出
  if (WiFiFlag){
    // Use WiFiClient class to create TCP connections 
    Serial.print("connecting to ");
    Serial.println(host);

    WiFiClient client;
    if (!client.connect(host, httpPort)) {
      Serial.println("connection failed");
    }
    // URIを生成  Host側がIdentifier,data1,data2,data3,data4,data5,data6を受け取るようにしているので使っていなくても数だけ""を入れる
    String url = "/data/data_logger.php";
           url += "?Identifier=" + String(Id);
           url += "&data1="+String(xx);
           url += "&data2=" +String("");
           url += "&data3=" +String("");
           url += "&data4="+String("");
           url += "&data5=" +String("");
           url += "&data6=" +String("");                    
    // Serial.print("Requesting URL: ");
    // Serial.println("GET "+url);
    // Hostにデータを送出
    client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                    "Host: " + host + "\r\n" +
                    "Connection: close\r\n\r\n"); 
    delay(50);
    // Hostからの応答を読み込み、serialに表示
    while(client.available()){
      String line = client.readStringUntil('\r');
      Serial.print(line);
    }
    Serial.println();
    Serial.println("closing connection");

  }

  //DEEP SLEEPモード突入命令
  Serial.println("DEEP SLEEP START!!");
  //1:μ秒での復帰までのタイマー時間設定  2:復帰するきっかけの設定(モード設定)
  //ESP.deepSleep( (30*1000*1000), WAKE_RF_DEFAULT); // 1 min
  ESP.deepSleep( (60*1000*1000) * 30, WAKE_RF_DEFAULT); // uint32 = 4294967296micro sec, 4295 sec, 1.1 hour.  でも30分位が限界?
  //deepsleepモード移行までのダミー命令
  delay(1000);
}

2016年4月4日月曜日

土壌水分計の制作 続き

ESP8266は使い勝手が良く、結構思ったことが簡単に実現できるので気に入ってます。
今回は、測定値を表示するためのI2CDisplayとWiFiのアドレスやデータの校正情報を個別に保存できるようにSDカードの接続を実験してみました。
I2CもSDカードも実にすんなり使うことが出来るようになりましたが、肝心のBaffaloの無線LanのルーターがDHCPを出してくれないので、ここでとん挫。  Failed status 37って何ですか? reason code とかstatus codeがLogに吐き出されますが、これらのコードの説明が見つからないために中断です。
I2CとSPIを使い、尚且つToutを使ったADCに、更に温度計と水分計の切り替えの為の1ポートと、目いっぱいの利用で、左のような接続で実験していますが、問題はないようです。
SDカードの読み出しは
myfile = SD.open()
myfile.read()
しかないようなので、一文字ずつバッファに書き出してゆくまどろっこしいコードになりますね。
コメントアウトした部分(未完成)も含めて、備忘録としてアップしておくことにします。

 I2CDisplay_update.ino



/*
 *  The circuit:
 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
 ** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila
 ** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
 ** CS - depends on your SD card shield or module.
    Pin 4 used here for consistency with other Arduino examples

 */
#include
extern "C" {
  #include "user_interface.h"
}
#include
#include
#include
#include
Sd2Card card;
const int chipSelect = 2; // IO2 not IO4

ST7032 lcd;

char ssid[30] = "*********************";
char password[30] = "#####################";
char Id[20] = "$$$$$$$$$$$$$$$$$$$";
char host[20] = "?????????????"; // host address ie. 192.168.100.100
File myFile;

float offset = 0.424;
float v = 0.0;
float temp = 0.0;
float vc = 0.00625;
float vref = 1.0;

void setup() {
  Serial.begin(115200);
  delay(10);

  byte mac_addr[6];
  WiFi.macAddress(mac_addr);
  char buff[20];
  Serial.print("Mac address: ");
  sprintf(buff, "%02X:%02X:%02X:%02X:%02X:%02X",
    mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
  Serial.println(buff);  // Check MAC address

  Serial.print("Initializing SD card...");
  if (!SD.begin(chipSelect)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
  Serial.println("");
  Serial.println("Started");

  // Read ssid, password, Id from SD card and put 'em to global variables
  read_ssid();
  read_password();
  read_Id();
  read_host();
  /*

  // First connect to WiFi

  Serial.print("Connecting to ");

  Serial.println(ssid); 

  WiFi.begin(ssid, password );

//  WiFi.begin("Baffalo-G-4CC0","65rhwri3nnee" );

  while (WiFi.status() != WL_CONNECTED) {

    delay(500);

    Serial.print(".");

  }

  Serial.println("");

  Serial.println("WiFi connected");

  Serial.println("IP address: ");

  Serial.println(WiFi.localIP());

*/
  // Set up LCD display
  lcd.begin(8,2);
  lcd.setContrast(25);
  delay(40);
}


void loop() {
  // put your main code here, to run repeatedly:
  /*

  Serial.print("connecting to ");

  Serial.println(host);

  WiFiClient client;

  const int httpPort = 80;

  if (!client.connect(host, httpPort)){

    Serial.println("connection failed");

    return;

  }

  String url = "/weather/weather_log.php";

         url += "?location=" + String(Identifier); // ID to identify location

         url += "&temperature="+String(t);

         url += "&humidity=" +String(h);

         url += "&pressure=" +String(p);

  Serial.print("Requesting URL: ");

  Serial.println("GET "+url);



  client.print(String("GET ") + url + " HTTP/1.1\r\n" +

                "Host: " + host + "\r\n" +

                "Connection: close\r\n\r\n");

  delay(50);

  // Read all the lines of the reply from server and print them to Serial

  Serial.println("Returned message from server: ");

  while(client.available()){

    String line = client.readStringUntil('\r');

    Serial.print(line);

  }



  Serial.println();

  Serial.println("closing connection");

  */
  String s1;
  String s2 = "*******";
  int temp;
  temp = measure_temp();
  s1 =  String(temp) + " C";
  lcd.clear();
  lcd.setCursor(2,0);
  lcd.print(s1);
  lcd.setCursor(0,1);
  lcd.print(s2);
  Serial.println(" ====  Temp = " + s1 );
  delay(1000);
}


int measure_temp(){
  uint ADC_Value = 0;
  float temp = 0.0;
  int i;
  for(i = 0;i < 30; i++){
    ADC_Value = system_adc_read();
    v = float(ADC_Value)/1024.0 * vref;
    temp = temp + (v-offset) / vc;
    delay(30);
  }
  return (int)temp/30;
}
void read_ssid(){
   // open the file for reading:
  myFile = SD.open("ssid.txt", FILE_READ);
  char *s = ssid;
  if (myFile) {
    Serial.println("ssid.txt");

    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      *s++ = myFile.read();
    }
    *s = '\0';
    // close the file:
    myFile.close();
    Serial.println(ssid );
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening ssid.txt");
  }
}
void read_password(){
  myFile = SD.open("password.txt");
  if (myFile) {
    Serial.println("password.txt");
    char *p = password;
    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      *p++ = myFile.read();
    }
    *p = '\0';
    // close the file:
    myFile.close();
    Serial.println(password);
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening password.txt");
  }
}
void read_Id(){
  myFile = SD.open("Id.txt");
  char *p = Id;
  if (myFile) {
    Serial.println("id.txt");

    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      *p++ = myFile.read();
    }
    *p = '\0';
    // close the file:
    myFile.close();
    Serial.println(Id);
  } else {I2c
    // if the file didn't open, print an error:
    Serial.println("error opening Id.txt");
  }
}  
void read_host(){
  myFile = SD.open("host.txt");
  char *p = Id;
  if (myFile) {
    Serial.println("host.txt");

    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      *p++ = myFile.read();
    }
    *p = '\0';
    // close the file:
    myFile.close();
    Serial.println(host);
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening host.txt");
  }
}

WSJT-x Super F/H

 WSJT-x使い始めてから随分経ちます(JT65しかなかった頃から)が、FT8のF/Hの使いがっ手の悪さ、MSHVの方が利用されている実態、F/HでFoxがマルチで返答すると信号が弱くなる、などからSuperF/Hが実装されましたね。  そこまでは、問題なく理解していたのですが...