Entwicklung SIGNALDuino Empfänger Firm- und Hardware V4 für Maple Mini und ESP32

Begonnen von Ralf9, 13 Dezember 2019, 12:48:26

Vorheriges Thema - Nächstes Thema

locutus

Hallo Ralf,

ich habe hier einen Kandidaten mit dem gepatchten Bootloader und der dev200501 Firmware, der den initialen USB Check nicht besteht:
opened -> no SIGNALduino found -> closed
2020.05.08 15:14:16 3: Opening MapleMini device /dev/ttyACM0
2020.05.08 15:14:16 3: Setting MapleMini serial parameters to 115200,8,N,1
2020.05.08 15:14:16 1: MapleMini: DoInit, /dev/ttyACM0@115200
2020.05.08 15:14:16 3: MapleMini device opened
2020.05.08 15:14:16 3: MapleMini: Attr, setting Verbose to: 5
2020.05.08 15:14:16 3: MapleMini: getAttrDevelopment, IdList ### Attribute development is in this version ignored ###
2020.05.08 15:14:16 3: MapleMini: IdList, attr whitelist disabled or not defined (all IDs are enabled, except blacklisted and instable IDs):
2020.05.08 15:14:16 3: MapleMini: IdList, MS 0 0.1 0.2 0.3 0.4 0.5 1 3 3.1 4 6 7 13 13.2 14 15 17 20 23 25 33 33.1 33.2 35 41 49 51 53 54.1 55 65 68 74.1 87 88 90 91.1 93
2020.05.08 15:14:16 3: MapleMini: IdList, MU 8 9 13.1 16 17.1 19 21 22 24 26 27 28 29 30 31 32 34 36 37 38 39 40 42 44 44.1 45 46 48 49.1 49.2 50 54 56 59 60 61 62 64 66 67 69 70 71 72 73 74 76 79 80 81 83 84 85 86 89 91 92 94 95 97
2020.05.08 15:14:16 3: MapleMini: IdList, MC 10 11 12 18 43 47 52 57 58 96
2020.05.08 15:14:16 4: MapleMini: IdList, development skipped = 2 5 63 72.1 75 77 82
2020.05.08 15:14:16 3: MapleMini: IdList, development protocol is active (to activate dispatch to not finshed logical module, enable desired protocol via whitelistIDs) = 2 72.1 82
2020.05.08 15:14:17 3: MapleMini: SimpleWrite_XQ, disable receiver (XQ)
2020.05.08 15:14:17 5: MapleMini: SimpleWrite, XQ
2020.05.08 15:14:18 3: MapleMini: StartInit, get version, retry = 0
2020.05.08 15:14:18 5: MapleMini: SimpleWrite, V
2020.05.08 15:14:28 5: MapleMini: CheckVersionResp, called without msg
2020.05.08 15:14:28 1: MapleMini: CheckVersionResp, Not an SIGNALduino device, got for V: undef
2020.05.08 15:14:28 3: MapleMini: StartInit, get version, retry = 1
2020.05.08 15:14:28 5: MapleMini: SimpleWrite, V
2020.05.08 15:14:38 5: MapleMini: CheckVersionResp, called without msg
2020.05.08 15:14:38 1: MapleMini: CheckVersionResp, Not an SIGNALduino device, got for V: undef
2020.05.08 15:14:38 3: MapleMini: StartInit, get version, retry = 2
2020.05.08 15:14:38 5: MapleMini: SimpleWrite, V
2020.05.08 15:14:48 5: MapleMini: CheckVersionResp, called without msg
2020.05.08 15:14:48 1: MapleMini: CheckVersionResp, Not an SIGNALduino device, got for V: undef
2020.05.08 15:14:48 3: MapleMini: StartInit, get version, retry = 3
2020.05.08 15:14:48 2: MapleMini: StartInit, retry count reached. Reset
2020.05.08 15:14:48 3: MapleMini: ResetDevice,
2020.05.08 15:15:18 3: Opening MapleMini device /dev/ttyACM0
2020.05.08 15:15:18 3: Setting MapleMini serial parameters to 115200,8,N,1
2020.05.08 15:15:18 1: MapleMini: DoInit, /dev/ttyACM0@115200
2020.05.08 15:15:18 3: MapleMini device opened
2020.05.08 15:15:19 3: MapleMini: SimpleWrite_XQ, disable receiver (XQ)
2020.05.08 15:15:19 5: MapleMini: SimpleWrite, XQ
2020.05.08 15:15:20 3: MapleMini: StartInit, get version, retry = 0
2020.05.08 15:15:20 5: MapleMini: SimpleWrite, V
2020.05.08 15:15:30 5: MapleMini: CheckVersionResp, called without msg
2020.05.08 15:15:30 1: MapleMini: CheckVersionResp, Not an SIGNALduino device, got for V: undef
2020.05.08 15:15:30 3: MapleMini: StartInit, get version, retry = 1
2020.05.08 15:15:30 5: MapleMini: SimpleWrite, V
2020.05.08 15:15:40 5: MapleMini: CheckVersionResp, called without msg
2020.05.08 15:15:40 1: MapleMini: CheckVersionResp, Not an SIGNALduino device, got for V: undef
2020.05.08 15:15:40 3: MapleMini: StartInit, get version, retry = 2
2020.05.08 15:15:40 5: MapleMini: SimpleWrite, V
2020.05.08 15:15:50 5: MapleMini: CheckVersionResp, called without msg
2020.05.08 15:15:50 1: MapleMini: CheckVersionResp, Not an SIGNALduino device, got for V: undef
2020.05.08 15:15:50 3: MapleMini: StartInit, get version, retry = 3
2020.05.08 15:15:50 2: MapleMini: StartInit, init retry count reached. Closed
2020.05.08 15:15:50 2: MapleMini: CloseDevice, closed


Mit dem gepatchten Bootloader und a-culfw hingegen verrichtet er wie gewohnt seine Dienste als CUL.

Ralf9

ich hab das hier gefunden,
ZitatUtility to send the reset sequence on RTS and DTR and chars
which resets the libmaple and causes the bootloader to be run
https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/master/tools/linux64/src/upload-reset/upload-reset.c

Dies müsste ins 00_Signalduino Modul eingebaut werden, ich kann aber nicht abschätzen ob dies machbar ist.
FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

juergs

Hallo Locutus,

ist Dein "Kandidat" ein original Maple oder ein MapleCUX?

Die Binary von Ralf9 oder selbst compiliert, wie upgeloaded?

Ist /dev/ttyACM0 die richtige Schnittstelle?

Bootloader lässt sich ja Testen: ein einfaches Serial-Sample hochzuladen, bzw. läuft dann mit einer Seriellen? 

Ralf9

Mit diesem Befehl lässt sich der Maple Mini reseten
./upload-reset /dev/ttyACM0 750
https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/master/tools

Wenn ich den upload-reset im 00_Signalduino Modul in der Sub SIGNALduino_ResetDevice einbaue, sollte sich der Maple Mini, so wie es auch beim nano funktioniert, sich beim einem Absturz selber reseten.

Ich teste dazu, so wie's auch beim avrdude gemacht wird, ob es das File upload-reset gibt
my $avrdudefound=0;
my $tool_name = "avrdude";
for my $path ( split /:/, $ENV{PATH} ) {
    if ( -f "$path/$tool_name" && -x _ ) {
    $avrdudefound=1;
        last;
    }
}


Damit es funktioniert muss dann die "upload-reset" dann in ein Verzeichnis der PATH Veriable kopieren.

Gruß Ralf
FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

Reinhard.M

Zitat von: Ralf9 am 08 Mai 2020, 09:17:27
Ja, diese ist auch ok. Ich möchte ausschließen, daß die Arduino IDE Version einen Einfluss hat. Ich habe die 1.8.10
Halo Ralf,
auch mit dem 1.8.10 Binary hängt sich der Maple auf. Die LED blinkt nicht mehr und das USB-Interface ist disconnected. Hier hilft auch kein Reset von Seiten des FHEM. Ich werde heute mal versuchen den Watchdog in Betrieb zu nehmen.

Ralf9

ZitatHier hilft auch kein Reset von Seiten des FHEM

Der jetzige Reset funktioniert bem Maple Mini nicht, wenn ich das "upload-reset" ins 00_Signalduino Modul einbaue, sollte der Reset funktionieren.
FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

locutus

Zitat von: juergs am 08 Mai 2020, 23:15:05
ist Dein "Kandidat" ein original Maple oder ein MapleCUX?
Der Kandidat ist ohne Netzwerkanbindung.

ZitatDie Binary von Ralf9 oder selbst compiliert, wie upgeloaded?
dev200501.bin aus dem GitHub Repo.

ZitatIst /dev/ttyACM0 die richtige Schnittstelle?
Definitv ja!
ls -l /dev/ttyACM0
crw-rw----+ 1 root dialout 166, 0 May  9 09:15 /dev/ttyACM0

Was mich allerdings wundert, ist das hier:
lsusb
Bus 001 Device 006: ID 0483:5740 STMicroelectronics Virtual COM Port

Sollte das nicht so aussehen?
Bus 001 Device 007: ID 1eaf:0003

ZitatBootloader lässt sich ja Testen: ein einfaches Serial-Sample hochzuladen, bzw. läuft dann mit einer Seriellen?
Die serielle Kommunikation mit a-culfw ist nicht beeinträchtigt.

juergs

Präziser:
ZitatDer Kandidat ist ohne Netzwerkanbindung.
Frage deshalb, ob der "Kandidat" die DICOVER-Funktionalität (USB-Reenumeration) beherrscht, oder nicht.
Bei Roger war auch mal von der falschen Quarzfrequenz die Rede ...

ZitatDie serielle Kommunikation mit a-culfw ist nicht beeinträchtigt.
aculw mit dem gleichen Bootloader?

Das Verhalten hatte ich auch schon mal und zwar mit dem falschen Bootloader, der nicht gepatcht war ...

Unter Windows das USBTreeView-Tool oder den Output dmesg.

Um zu sehen "was" connected ist ...

Ralf9

Verwendest Du den Maple Mini oder Deine eigene Hardware?

Funktioniert es mit einem ungepatchten Bootloader2.0?

Mit "lsusb" erhalte ich
Bus 001 Device 031: ID 0483:5740 STMicroelectronics STM32F407

mit "dmesg" erhalte ich am Ende
[18617.777084] usb 1-9: new full-speed USB device number 30 using xhci_hcd
[18617.926244] usb 1-9: New USB device found, idVendor=1eaf, idProduct=0003
[18617.926245] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[18617.926246] usb 1-9: Product: Maple 003
[18617.926247] usb 1-9: Manufacturer: LeafLabs
[18617.926247] usb 1-9: SerialNumber: LLM 003
[18619.244092] usb 1-9: USB disconnect, device number 30
[18619.553088] usb 1-9: new full-speed USB device number 31 using xhci_hcd
[18619.702396] usb 1-9: New USB device found, idVendor=0483, idProduct=5740
[18619.702397] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[18619.702398] usb 1-9: Product: MAPLEMINI_F103CB CDC in FS Mode
[18619.702399] usb 1-9: Manufacturer: STMicroelectronics
[18619.702399] usb 1-9: SerialNumber: 8D7452895051
[18619.702852] cdc_acm 1-9:1.0: ttyACM0: USB ACM device

FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

juergs

Bei mir hat sich so ganz "unbemerkt" ein älterer ARM-Compiler eingeschlichen ...
\AppData\\Local\\Arduino15\\packages\\Seeeduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-ar"
Wohl weil er am Anfang des  Pfadeintrages sitzt...  :(

https://forum.fhem.de/index.php/topic,60458.msg1040559/topicseen.html#msg1040559
https://forum.fhem.de/index.php/topic,38404.msg306225.html#msg306225
https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update

Ralf9

hier hat nun auch stevestrong was dazu geschrieben:
https://www.stm32duino.com/viewtopic.php?p=2653#p2653
ZitatUSB DISC PIN low means that USB DP is tied to +5V.
This is correct, the USB DP pin must be high when initializing the USB.
Important is to toggle the USB DP pin from low -> high, wherein the last high is sometimes done by re-configuring the pin, see
https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/master/STM32F1/variants/generic_stm32f103c/wirish/boards_setup.cpp#L103-L107
In this case USB_DISC pin should toggle from high -> low and stay in this state.
Demnach muß der Bootloader2.0 nicht gepatcht werden.
Der Bug ist demnach im core 1.8.0 dort fehlt anscheinend dies:
https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/master/STM32F1/variants/generic_stm32f103c/wirish/boards_setup.cpp#L103-L107
FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

Ralf9

ZitatDein angepasstes SIGNALduino Modul scheint mit den Readings noch ein Problem zu haben, da steht bei mir im Grunde kaum etwas Nachvollziehbares. Falsche Version, falsche Konfiguration.
Habe das Schreiben in die Readings verbessert
https://github.com/Ralf9/RFFHEM/commit/7294042970f857f554571a508717ca7ac37cf526

Habe heute Abend vor dies einzubauen
ZitatWenn ich den upload-reset im 00_Signalduino Modul in der Sub SIGNALduino_ResetDevice einbaue, sollte sich der Maple Mini, so wie es auch beim nano funktioniert, sich beim einem Absturz selber reseten.

Ich habe mittlerweise in meinem Testsystem bei der USB Version eine uptime von 20 Stunden

Nachtrag:
habe auch in der Firmware ein paar Kleinigkeiten ergänzt
https://github.com/Ralf9/SIGNALDuino/commit/88f72c279e7a6c0f878be065259a0340667e1e49
https://github.com/Ralf9/SIGNALDuino/releases
FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

Ralf9

hat es schon jemand hinbekommen, daß "dfu-util" auch ohne Root Rechte funktioniert?

> ./dfu-util -v -d 1eaf:0003 -a 2 -D Maple_sduino_Boot20_USB_411dev200509.bin -R
dfu-util 0.8                                                                                                                                                                   
                                                                                                                                                                               
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.                                                                                                             
Copyright 2010-2014 Tormod Volden and Stefan Schmidt                                                                                                                           
This program is Free Software and has ABSOLUTELY NO WARRANTY                                                                                                                   
Please report bugs to dfu-util@lists.gnumonks.org

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
dfu-util: Cannot open DFU device 1eaf:0003
dfu-util: No DFU capable USB device available


dies habe ich schon ausgeführt
#!/bin/sh

if sudo [ -w /etc/udev/rules.d ]; then
    echo "Copying Maple-specific udev rules..."
    sudo cp -v 45-maple.rules /etc/udev/rules.d/45-maple.rules
    sudo chown root:root /etc/udev/rules.d/45-maple.rules
    sudo chmod 644 /etc/udev/rules.d/45-maple.rules
    echo "Reloading udev rules"
    sudo udevadm control --reload-rules
    echo "Adding current user to dialout group"
    sudo adduser $USER dialout
else
    echo "Couldn't copy to /etc/udev/rules.d/; you probably have to run this script as root? Or your distribution of Linux doesn't include udev; try running the IDE itself as root."
fi


Gruß Ralf
FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

locutus

Zitat von: Ralf9 am 09 Mai 2020, 09:47:59
Verwendest Du den Maple Mini oder Deine eigene Hardware?
Meine eigene Hardware. Die USB Disconnect Schaltung ist vorhanden.

ZitatFunktioniert es mit einem ungepatchten Bootloader2.0?
Nein, auch nicht.

Zitatmit "dmesg" erhalte ich am Ende
Die Device ID stimmt also. Auch der dmesg Inhalt ist nahezu identisch:
[ 1839.883664] usb 1-1.3: new full-speed USB device number 4 using xhci_hcd
[ 1840.018965] usb 1-1.3: New USB device found, idVendor=1eaf, idProduct=0003, bcdDevice= 2.01
[ 1840.018980] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1840.018994] usb 1-1.3: Product: Maple 003
[ 1840.019007] usb 1-1.3: Manufacturer: LeafLabs
[ 1840.019018] usb 1-1.3: SerialNumber: LLM 003
[ 1842.346071] usb 1-1.3: USB disconnect, device number 4
[ 1842.643692] usb 1-1.3: new full-speed USB device number 5 using xhci_hcd
[ 1842.778873] usb 1-1.3: New USB device found, idVendor=1eaf, idProduct=0003, bcdDevice= 2.01
[ 1842.778888] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1842.778901] usb 1-1.3: Product: Maple 003
[ 1842.778914] usb 1-1.3: Manufacturer: LeafLabs
[ 1842.778925] usb 1-1.3: SerialNumber: LLM 003
[ 1874.874337] usb 1-1.3: reset full-speed USB device number 5 using xhci_hcd
[ 1875.004771] usb 1-1.3: device firmware changed
[ 1875.005703] usb 1-1.3: USB disconnect, device number 5
[ 1875.104130] usb 1-1.3: new full-speed USB device number 6 using xhci_hcd
[ 1875.241676] usb 1-1.3: New USB device found, idVendor=0483, idProduct=5740, bcdDevice= 2.00
[ 1875.241692] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1875.241705] usb 1-1.3: Product: MAPLEMINI_F103CB CDC in FS Mode
[ 1875.241717] usb 1-1.3: Manufacturer: STMicroelectronics
[ 1875.241729] usb 1-1.3: SerialNumber: 6565BF8F3332
[ 1875.313695] cdc_acm 1-1.3:1.0: ttyACM0: USB ACM device
[ 1875.315306] usbcore: registered new interface driver cdc_acm
[ 1875.315315] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 2116.050533] usb 1-1.3: USB disconnect, device number 6
[ 2116.547564] usb 1-1.3: new full-speed USB device number 7 using xhci_hcd
[ 2116.682763] usb 1-1.3: New USB device found, idVendor=1eaf, idProduct=0003, bcdDevice= 2.01
[ 2116.682778] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2116.682791] usb 1-1.3: Product: Maple 003
[ 2116.682804] usb 1-1.3: Manufacturer: LeafLabs
[ 2116.682815] usb 1-1.3: SerialNumber: LLM 003
[ 2129.768080] usb 1-1.3: reset full-speed USB device number 7 using xhci_hcd
[ 2129.898599] usb 1-1.3: device firmware changed
[ 2129.899566] usb 1-1.3: USB disconnect, device number 7
[ 2129.997833] usb 1-1.3: new full-speed USB device number 8 using xhci_hcd
[ 2130.135378] usb 1-1.3: New USB device found, idVendor=0483, idProduct=5740, bcdDevice= 2.00
[ 2130.135394] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2130.135407] usb 1-1.3: Product: MAPLEMINI_F103CB CDC in FS Mode
[ 2130.135419] usb 1-1.3: Manufacturer: STMicroelectronics
[ 2130.135431] usb 1-1.3: SerialNumber: 6565BF8F3332


Bisher traue ich den EEPROM Updates für RPi4 und den daraus resultierenden Verschlimbesserungen für USB nicht über den weg.

juergs

Die STMduion 1.8er core zickt etwas herum mit den USARTS 2+3:

HardwareSerial Serial2(USART2);
HardwareSerial Serial3(USART3);


In setup():


    Serial.begin(BAUDRATE);

    Serial2.setTx(PA2)
    Serial2.setRx(PA3)
    Serial3.setTx(PB10)
    Serial3.setRx(PB11)

    Serial2.begin(115200); //--- is W600 port cmd/data port  // See: C:\Users\js\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino\HardwareSerial.h
    Serial3.begin(115200);//--- debug TextTerminal


und:
if (Serial2.available())
    Serial2.println("Setup done. #2");

  if (Serial3.available())
    Serial3.println("Setup done. #3");



Es gibt auch noch Varianten z.B. für 8N1:
Serial2.begin(115200, 0x06);

Wie in: "HardwareSerial.cpp" definiert.

Hat leider noch nicht funktioniert. Scheint doch etwas komplizierter zu sein, als ich dachte.
Versuche morgen nochmal mein Glück.  ;)

https://github.com/stm32duino/wiki/wiki/API#hardwareserial