TomMajor hat geschrieben: ↑18.06.2023, 00:33
Gerne, freut mich.
Ich konnte dir aber nur bei dem Compiler Fehler helfen aufgrund der Fehlermeldung, habe das Gerät selbst nicht aufgebaut und weiß nichts darüber..
Ah OK;
Ich habe jetzt mal ein wenig gespielt und versucht die Sketche als Binärdatei zu exportieren.
Ernüchternd... Hier erhalte ich bei Beiden (Frequenztest und Poolsensor) die Fehlermeldung:
Code: Alles auswählen
Der Sketch verwendet 12510 Bytes (9%) des Programmspeicherplatzes. Das Maximum sind 130048 Bytes.
Globale Variablen verwenden 651 Bytes (3%) des dynamischen Speichers, 15733 Bytes für lokale Variablen verbleiben. Das Maximum sind 16384 Bytes.
Zugriff verweigert
exit status 1
Compilation error: exit status 1
Weiter ist mir nach mehrmaligen Beobachten aufgefallen, dass der oben erwähnte Blinkcode
Seltsamerweise blinkt die LED beim Anschluss des FDTI ein ca 5 oder 6 mal im 2er Takt auf, danach ist Ruhe.
der Gleiche ist wie nach dem brennen des Bootloaders.
Ich habe die Vermutung, dass der Sketch gar nicht auf den MCU geschrieben wird.
Code: Alles auswählen
//---------------------------------------------------------
// FreqTest_1284 for tmStamp-1284-RF
// Version 1.00
// 12/2021 Tom Major (Creative Commons)
// https://creativecommons.org/licenses/by-nc-sa/4.0/
// You are free to Share & Adapt under the following terms:
// Give Credit, NonCommercial, ShareAlike
// +++
// AskSin++ 2016-10-31 papa Creative Commons
//---------------------------------------------------------
#define EI_NOTEXTERNAL
#include <EnableInterrupt.h>
#include <SPI.h>
#include <AskSinPP.h>
#include <Device.h>
#include <Register.h>
// we use a mega1284P
#define LED_PIN 0 // PA7
#define CC1101_CS_PIN 4 // PB4
#define CC1101_GDO0_PIN 2 // PB2
// all library classes are placed in the namespace 'as'
using namespace as;
// define all device properties
const struct DeviceInfo PROGMEM devinfo = {
{0x01,0x01,0x01}, // Device ID
"FreqTest00", // Device Serial
{0x00,0x00}, // Device Model
0x10, // Firmware Version
as::DeviceType::Sensor, // Device Type
{0x00,0x00} // Info Bytes
};
/**
* Configure the used hardware
*/
typedef LibSPI<CC1101_CS_PIN> SPIType;
typedef Radio<SPIType, CC1101_GDO0_PIN> RadioType;
typedef StatusLed<LED_PIN> LedType;
typedef AskSin<LedType,NoBattery,RadioType> HalType;
#define STARTFREQ 0x656A // frequency we start scanning
#define MINFREQ (STARTFREQ - 0x300) // frequency we abort scanning
#define SEARCHSTEP 0x50 // step with during search
#define BOUNDSTEP 0x10 // step width during upper/lower bound analysis
#define ACTIVE_PING
// hier die CCU Adresse eintragen
// Ausgabe mit: grep BidCoS-Address /etc/config/ids
HMID PING_TO(0x99,0x66,0x99);
// hier die Adresse eines Gerätes eintragen was antworten soll, am Besten ein Netzgerät (Switch, schaltbare Steckdose usw.)
// Ausgabe mit: grep -i "\" address=\"0x" /etc/config/rfd/*.dev|awk {'print $2 " " $4 " " $3'}
HMID PING_FROM(0x12,0x34,0x56);
#ifdef ACTIVE_PING
#define SCANTIME seconds2ticks(5) // maximal time to wait for a valid message
#else
#define SCANTIME seconds2ticks(60) // maximal time to wait for a valid message
#endif
class TestDevice : public Device<HalType,DefList0>, Alarm {
DefList0 l0;
uint16_t freq, start, end;
uint8_t received, rssi;
public:
enum SearchMode { Search, Up, Down, Done };
SearchMode mode;
HMID id;
typedef Device<HalType,DefList0> BaseDevice;
TestDevice (const DeviceInfo& i,uint16_t addr) : BaseDevice(i,addr,l0,0), Alarm(0), l0(addr),
freq(STARTFREQ), start(STARTFREQ), end(STARTFREQ),
received(0), rssi(0), mode(Search) {}
virtual ~TestDevice () {}
virtual void trigger (__attribute__ ((unused)) AlarmClock& clock) {
DPRINT(" ");DDEC(received);
if (!received) {
DPRINTLN("");
} else {
DPRINT(" / -");DDEC(rssi);DPRINTLN("dBm");
}
if( mode == Search ) {
if( received > 0 ) {
start = end = freq;
mode = Up; // start find upper bound
DPRINTLN("Search for upper bound");
setFreq(freq + BOUNDSTEP);
}
else {
if( freq < MINFREQ ) mode = Done;
if( freq <= STARTFREQ ) setFreq(STARTFREQ + (STARTFREQ-freq) + SEARCHSTEP);
else setFreq(STARTFREQ - (freq-STARTFREQ));
}
}
else if(mode == Up) {
if( received > 0 ) {
end = freq;
setFreq(end + BOUNDSTEP);
}
else {
mode = Down; // start find lower bound
DPRINTLN("Search for lower bound");
setFreq(start - BOUNDSTEP);
}
}
else if(mode == Down) {
if( received > 0 ) {
start = freq;
setFreq(start - BOUNDSTEP);
}
else {
mode = Done;
}
}
if( mode == Done ) {
DPRINT("\nDone: 0x21");DHEX(start);DPRINT(" - 0x21");DHEXLN(end);
if( start == end && start == STARTFREQ ) {
DPRINT("Could not receive any message");
}
else {
freq = start+((end - start)/2);
DPRINT("Calculated Freq: 0x21");DHEX((uint8_t)(freq>>8));DHEX((uint8_t)(freq&0xff));
printFreq(0x210000 + freq);DPRINTLN("");
// store frequency
DPRINT("Store into config area: ");DHEX((uint8_t)(freq>>8));DHEXLN((uint8_t)(freq&0xff));
StorageConfig sc = getConfigArea();
sc.clear();
sc.setByte(CONFIG_FREQ1, freq>>8);
sc.setByte(CONFIG_FREQ2, freq&0xff);
sc.validate();
activity().savePower<Sleep<> >(this->getHal());
}
}
}
virtual bool process(Message& msg) {
msg.from().dump(); DPRINT(".");
rssi = max(rssi,radio().rssi());
received++;
if( received > 0 ) {
trigger(sysclock);
}
return true;
}
bool init (HalType& hal) {
this->setHal(hal);
this->getDeviceID(id);
hal.init(id);
DPRINTLN("Start searching ...");
setFreq(STARTFREQ);
return false;
}
void setFreq (uint16_t current) {
sysclock.cancel(*this);
freq = current;
rssi=0;
received=0;
DPRINT("Freq 0x21");DHEX(freq);
printFreq(0x210000 + freq);
DPRINT(": ");
this->radio().initReg(CC1101_FREQ2, 0x21);
this->radio().initReg(CC1101_FREQ1, freq >> 8);
this->radio().initReg(CC1101_FREQ0, freq & 0xff);
set(SCANTIME);
sysclock.add(*this);
}
void printFreq(uint32_t freq) {
char buffer[16];
float val = (float)freq * 26.0 / 65536.0;
dtostrf(val, 8, 3, buffer);
DPRINT(buffer);DPRINT(" MHz");
}
};
HalType hal;
TestDevice sdev(devinfo,0x20);
class InfoSender : public Alarm {
class channel {
public:
uint8_t number() const {return 1; }
uint8_t status() const {return 0; }
uint8_t flags() const {return 0; }
void patchStatus(__attribute__ ((unused)) Message& msg) {}
void changed(__attribute__ ((unused)) bool b) {}
};
uint8_t cnt;
channel ch;
public:
InfoSender () : Alarm(0), cnt(0) {}
virtual ~InfoSender () {}
virtual void trigger (AlarmClock& clock) {
#ifdef ACTIVE_PING
InfoActuatorStatusMsg msg;
msg.init(cnt++, ch, hal.radio.rssi());
msg.to(PING_TO);
msg.from(PING_FROM);
msg.ackRequired();
msg.setRpten();
sdev.radio().write(msg,msg.burstRequired());
#endif
sdev.led().ledOn(millis2ticks(100), 0);
if( sdev.mode != TestDevice::SearchMode::Done ) {
set(seconds2ticks(1));
clock.add(*this);
}
}
} info;
void setup () {
DINIT(57600,ASKSIN_PLUS_PLUS_IDENTIFIER);
sdev.init(hal);
// start sender
info.trigger(sysclock);
}
void loop() {
sdev.pollRadio();
hal.runready();
}
Dennoch erhalte wird das Hochladen als "done" verifiziert
Code: Alles auswählen
Der Sketch verwendet 12510 Bytes (9%) des Programmspeicherplatzes. Das Maximum sind 130048 Bytes.
Globale Variablen verwenden 651 Bytes (3%) des dynamischen Speichers, 15733 Bytes für lokale Variablen verbleiben. Das Maximum sind 16384 Bytes.
"C:\Users\Startklar\AppData\Local\Arduino15\packages\MightyCore\tools\avrdude\7.1-arduino.1/bin/avrdude" "-CC:\Users\Startklar\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.2.2/avrdude.conf" -v -patmega1284p -carduino -PCOM3 -b38400 -D "-Uflash:w:C:\Users\Startklar\AppData\Local\Temp\arduino\sketches\01D3F586D04BE82D499F39E2FBDE70E2/sketch_jun18a.ino.hex:i"
avrdude: Version 7.1-arduino.1
Copyright the AVRDUDE authors;
see https://github.com/avrdudes/avrdude/blob/main/AUTHORS
System wide configuration file is C:\Users\Startklar\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.2.2\avrdude.conf
Using Port : COM3
Using Programmer : arduino
Overriding Baud Rate : 38400
AVR Part : ATmega1284P
Chip Erase delay : 55000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : possible i/o
RETRY pulse : SCK
Serial program mode : yes
Parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 128 0 no 4096 8 0 9000 9000 0xff 0xff
flash 65 10 256 0 yes 131072 256 512 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 1 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 1 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 1 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 1 0 9000 9000 0x00 0x00
signature 0 0 0 0 no 3 1 0 0 0 0x00 0x00
calibration 0 0 0 0 no 1 1 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino for bootloader using STK500 v1 protocol
Hardware Version: 3
Firmware Version: 8.0
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9705 (probably m1284p)
avrdude: reading input file C:\Users\Startklar\AppData\Local\Temp\arduino\sketches\01D3F586D04BE82D499F39E2FBDE70E2/sketch_jun18a.ino.hex for flash
with 12510 bytes in 1 section within [0, 0x30dd]
using 49 pages and 34 pad bytes
avrdude: writing 12510 bytes flash ...
Writing | ################################################## | 100% 4.80s
avrdude: 12510 bytes of flash written
avrdude: verifying flash memory against C:\Users\Startklar\AppData\Local\Temp\arduino\sketches\01D3F586D04BE82D499F39E2FBDE70E2/sketch_jun18a.ino.hex
Reading | ################################################## | 100% 4.70s
avrdude: 12510 bytes of flash verified
avrdude done. Thank you.