diff --git a/F0:F030,F042,F072/Socket_fans/kicad/stm32.kicad_prl b/F0:F030,F042,F072/Socket_fans/kicad/stm32.kicad_prl index fe8e204..97a1177 100644 --- a/F0:F030,F042,F072/Socket_fans/kicad/stm32.kicad_prl +++ b/F0:F030,F042,F072/Socket_fans/kicad/stm32.kicad_prl @@ -41,7 +41,6 @@ 11, 12, 13, - 14, 15, 16, 17, diff --git a/F0:F030,F042,F072/Socket_fans/kicad/stm32.kicad_pro b/F0:F030,F042,F072/Socket_fans/kicad/stm32.kicad_pro index 3ab5a58..b0d56a6 100644 --- a/F0:F030,F042,F072/Socket_fans/kicad/stm32.kicad_pro +++ b/F0:F030,F042,F072/Socket_fans/kicad/stm32.kicad_pro @@ -75,6 +75,7 @@ "footprint_type_mismatch": "ignore", "hole_clearance": "error", "hole_near_hole": "error", + "holes_co_located": "warning", "invalid_outline": "error", "isolated_copper": "warning", "item_on_disabled_layer": "error", diff --git a/F1:F103/BISS_C_encoders/encoders.bin b/F1:F103/BISS_C_encoders/encoders.bin index 97dee9e..4940f07 100755 Binary files a/F1:F103/BISS_C_encoders/encoders.bin and b/F1:F103/BISS_C_encoders/encoders.bin differ diff --git a/F1:F103/BISS_C_encoders/encoders.creator.user b/F1:F103/BISS_C_encoders/encoders.creator.user index 48b5440..ea04e00 100644 --- a/F1:F103/BISS_C_encoders/encoders.creator.user +++ b/F1:F103/BISS_C_encoders/encoders.creator.user @@ -1,10 +1,10 @@ - + EnvironmentId - {cf63021e-ef53-49b0-b03b-2f2570cdf3b6} + {7bd84e39-ca37-46d3-be9d-99ebea85bc0d} ProjectExplorer.Project.ActiveTarget @@ -40,9 +40,9 @@ 1 0 false - false + true false - 1 + 0 true true 0 @@ -51,10 +51,10 @@ false 1 true - true + false true *.md, *.MD, Makefile - true + false true true @@ -79,7 +79,7 @@ true true Builtin.DefaultTidyAndClazy - 4 + 8 true @@ -92,14 +92,14 @@ ProjectExplorer.Project.Target.0 Desktop + true Desktop Desktop - {91347f2c-5221-46a7-80b1-0a054ca02f79} + {65a14f9e-e008-4c1b-89df-4eaa4774b6e3} 0 0 0 - /home/eddy/Docs/SAO/ELECTRONICS/STM32/F1-srcs/BISS_C_encoders @@ -109,8 +109,8 @@ GenericProjectManager.GenericMakeStep 1 - Сборка - Сборка + Build + Build ProjectExplorer.BuildSteps.Build @@ -122,8 +122,8 @@ GenericProjectManager.GenericMakeStep 1 - Очистка - Очистка + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -131,15 +131,49 @@ false - По умолчанию + Default GenericProjectManager.GenericBuildConfiguration + 0 + 0 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + 0 + true + + + 2 + + false + -e cpu-cycles --call-graph dwarf,4096 -F 250 + + ProjectExplorer.CustomExecutableRunConfiguration + + false + true + true + + 1 1 0 - Развёртывание - Развёртывание + Deploy + Deploy ProjectExplorer.BuildSteps.Deploy 1 diff --git a/F1:F103/BISS_C_encoders/usb_dev.c b/F1:F103/BISS_C_encoders/usb_dev.c index d9bcdfc..aa668a3 100644 --- a/F1:F103/BISS_C_encoders/usb_dev.c +++ b/F1:F103/BISS_C_encoders/usb_dev.c @@ -19,6 +19,7 @@ #include #include "ringbuffer.h" +#include "strfunc.h" // for cmd interface #include "usb_descr.h" #include "usb_dev.h" @@ -42,6 +43,8 @@ #undef DBGs #define DBGs(x) +extern volatile uint32_t Tms; + // inbuf overflow when receiving static volatile uint8_t bufovrfl[bTotNumEndpoints] = {0}; @@ -110,7 +113,7 @@ static void rxtx_handler(){ DBG("rxtx_handler"); DBGs(uhex2str(ifno)); if(ifno > bTotNumEndpoints-1){ - DBG("wront ifno"); + DBG("wrong ifno"); return; } uint16_t epstatus = KEEP_DTOG(USB->EPnR[1+ifno]); @@ -138,6 +141,8 @@ void WEAK linecoding_handler(uint8_t ifno, usb_LineCoding *lc){ lineCoding[ifno] = *lc; DBG("linecoding_handler"); DBGs(uhex2str(ifno)); + CMDWR("Interface "); CMDWR(u2str(ifno)); + CMDWR(" got linecoding with speed "); CMDWRn(u2str(lc->dwDTERate)); } // SET_CONTROL_LINE_STATE @@ -147,6 +152,9 @@ void WEAK clstate_handler(uint8_t ifno, uint16_t val){ DBGs(uhex2str(val)); CDCready[ifno] = val; // CONTROL_DTR | CONTROL_RTS -> interface connected; 0 -> disconnected lastdsz[ifno] = -1; + if(val == 0) CMDWR("dis"); + CMDWR("connected interface "); + CMDWRn(u2str(ifno)); } // SEND_BREAK @@ -155,6 +163,8 @@ void WEAK break_handler(uint8_t ifno){ lastdsz[ifno] = -1; DBG("break_handler()"); DBGs(uhex2str(ifno)); + CMDWR("Disconnected interface "); + CMDWRn(u2str(ifno)); } @@ -172,13 +182,13 @@ void set_configuration(){ } } -// PL2303 CLASS request +// USB CDC CLASS request void usb_class_request(config_pack_t *req, uint8_t *data, uint16_t datalen){ uint8_t recipient = REQUEST_RECIPIENT(req->bmRequestType); uint8_t dev2host = (req->bmRequestType & 0x80) ? 1 : 0; uint8_t ifno = req->wIndex >> 1; if(ifno > bTotNumEndpoints-1 && ifno != 0xff){ - DBG("wront ifno"); + DBG("wrong ifno"); return; } DBG("usb_class_request"); @@ -222,7 +232,12 @@ void usb_class_request(config_pack_t *req, uint8_t *data, uint16_t datalen){ // blocking send full content of ring buffer int USB_sendall(uint8_t ifno){ + uint32_t T0 = Tms; while(lastdsz[ifno] > 0){ + if(Tms - T0 > DISCONN_TMOUT){ + break_handler(ifno); + return FALSE; + } if(!CDCready[ifno]) return FALSE; IWDG->KR = IWDG_REFRESH; } diff --git a/F1:F103/BISS_C_encoders/usb_dev.h b/F1:F103/BISS_C_encoders/usb_dev.h index 7f32ac6..5641e20 100644 --- a/F1:F103/BISS_C_encoders/usb_dev.h +++ b/F1:F103/BISS_C_encoders/usb_dev.h @@ -46,6 +46,8 @@ void break_handler(uint8_t ifno); void clstate_handler(uint8_t ifno, uint16_t val); void linecoding_handler(uint8_t ifno, usb_LineCoding *lc); +// as ugly CDC have no BREAK after disconnected client in non-canonical mode, we should use timeout - more than 2ms +#define DISCONN_TMOUT (2) // sizes of ringbuffers for outgoing and incoming data #define RBOUTSZ (512) diff --git a/F1:F103/BISS_C_encoders/version.inc b/F1:F103/BISS_C_encoders/version.inc index 4e70e46..2f05971 100644 --- a/F1:F103/BISS_C_encoders/version.inc +++ b/F1:F103/BISS_C_encoders/version.inc @@ -1,2 +1,2 @@ -#define BUILD_NUMBER "108" -#define BUILD_DATE "2025-06-03" +#define BUILD_NUMBER "111" +#define BUILD_DATE "2025-07-15"