UDPI and standard Drivers

  • 1
  • 2
  • 3
  • 4
  • Page 1 of 4
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1362
Registered: 03 / 2005
Subject:

UDPI and standard Drivers

 · 
Posted: 19.10.2021 - 13:24  ·  #1
I have started to implement UPDI drivers, but it is a big undertaking.

I am looking for people to try these out.

I have concentrated for the moment on two chips - the ATTiny412, which DG wants to use, and the ATMega4808 which Toni B wants to use. I have modified both DSC files to correct issues found in both, and the modified files are attached.

Both projects supplied to me by these need correcting, so I would ask DG and Toni to modify and resubmit their projects.

Anyone else who uses, or wants to use, standard drivers with any UPDI chip (DSC file begins with 'u') is welcome to submit their projects.

I would ask that unless your project contains sensitive information, that you post your comments and projects here to avoid my pm inbox becoming full. Also please post complete projects (the whole directory(s)). Do not expect me to build a project file, as I simply do not have the time.

This is an intermediate compile and will not be released via the normal download mechanism as it is intended only for those willing to test the UPDI implementation.

Thanks in anticipation

Ich habe begonnen, UPDI-Treiber zu implementieren, aber das ist ein großes Unterfangen.

Ich bin auf der Suche nach Leuten, die diese ausprobieren.

Ich habe mich im Moment auf zwei Chips konzentriert - den ATTiny412, den DG verwenden möchte, und den ATMega4808, den Toni B verwenden möchte. Ich habe beide DSC-Dateien modifiziert, um Probleme zu beheben, die ich in beiden gefunden habe, und die modifizierten Dateien sind beigefügt.

Beide Projekte, die mir von diesen zur Verfügung gestellt wurden, müssen korrigiert werden, daher möchte ich DG und Toni bitten, ihre Projekte zu ändern und erneut einzureichen.

Alle anderen, die Standardtreiber mit einem UPDI-Chip (DSC-Datei beginnt mit 'u') verwenden oder verwenden wollen, können ihre Projekte ebenfalls einreichen.

Sofern Ihr Projekt keine sensiblen Informationen enthält, möchte ich Sie bitten, Ihre Kommentare und Projekte hier zu posten, um zu vermeiden, dass mein Posteingang voll wird. Bitte posten Sie auch vollständige Projekte (das ganze Verzeichnis/die ganzen Verzeichnisse). Erwarten Sie nicht, dass ich eine Projektdatei erstelle, da ich einfach nicht die Zeit dazu habe.

Dies ist eine Zwischenkompilierung und wird nicht über den normalen Download-Mechanismus veröffentlicht, da sie nur für diejenigen gedacht ist, die die UPDI-Implementierung testen wollen.

Vielen Dank in Voraussicht

Merlin

PS I frefer zip to rar, but can handle either.
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1362
Registered: 03 / 2005
Subject:

Re: UDPI and standard Drivers

 · 
Posted: 21.10.2021 - 13:16  ·  #2
Following feedback from DG I have updated the compiler.

Nach dem Feedback von DG habe ich den Compiler aktualisiert.
tbegle
Benutzer
Avatar
Gender: n/a
Age: 63
Posts: 150
Registered: 01 / 2018
Subject:

Re: UDPI and standard Drivers

 · 
Posted: 25.10.2021 - 16:07  ·  #3
Hi Merlin,

my current test programm



program MC4808_Check_03; // Merlin 24.10.21

{ -------------------------- ---------------------------------------------------

Hi Dave,

Important to me:

ADC Port's 1-4 (6)
I2C Port
ISP Port
TX/RX(1) example 115,2kB
TX/RX(2) 9,6kB
(TX/RX(3))
sleep (timer)

kind regards
Toni

// ---------------- Thinary NANO Atmega 4808 (34 PIN!) ---------------------

PD6 D24
VIN 23 8-12V VIN Input
GND 22 GND
PF6 RST
+5V 21 +5V
PF5 A7
PF4 A6
PF3 A5 SCL
PF2 A4 SDA
PD3 A3
PD2 A2
PD1 A1
PD0 A0
PD7 AREF
3,3V
PC2 D13 SCK (LED)
PD5 D23
PD4 D22
PC1 D12 MISO
PC0 D11 MOSI
PC3 D10 SS
PA7 D9 CLK(ACout)
PA6 D8 PB0
PA5 D7 PD7
PA4 D6
PA3 D5 SCL
PA2 D4 SDA
PA1 D3 RX0
PA0 D2 TX0
GND GND
PF6 RST Reset
PF1 01 RX2
PF0 00 TX2
UPDI UPDI (Pin1)

// ---------------------------- Prog Einstellungen ------------------------- }

{$NOSHADOW}
{ $WG} {global Warnings off}
{ $EEPROM}

// ??????????????????????????????????????????????????????????????????

Device = mega328p, VCC = 5;
{ $BOOTRST $03800} {Reset Jump to $03800}
Define_Fuses
Override_Fuses;
COMport = USB2;
LockBits0 = [];
FuseBits0 = [CKSEL0, CKSEL1, SUT0]; // > 8MHz?
FuseBits2 = [];
ProgMode = SPI;
ProgFuses = false; // ausschalten!!!!
ProgLock = false;
ProgFlash = true;
ProgEEprom = true;
Supply = 5.0,200;
// ----------------------------- Arduino Nano BOARD-------------------------
Import SysTick,SerPort,TWIMaster,ADCPort; //BeepPort; Watchdog,
From System Import float;
Define
ProcClock = 16000000;
SysTick = 10; // msec
StackSize = $100, iData;
FrameSize = $100, iData;
// WatchDog = 6; // 1024msec
SerPort = 9600, Stop1; //
RxBuffer = 8, iData; //
TxBuffer = 8, iData; //
TWIpresc = TWI_BR400; // TWI speed max 400kHz
ADCchans = [1..6],iData; //
ADCpresc = 64; //
// BeepPort = PortB,1; // Signal
Implementation
{$IDATA}
var
Timer3 : SysTimer; {Variable vom Typ als SysTimer!}

// ??????????????????????????????????????????????????????????????????

{--------------------------------------------------------------}
{ Type Declarations }
type
{ Const Declarations }
const
// BH1750 : byte = $23; // Licht Sensor
// Lidar0 : byte = $29; // LIDAR0
// HDC1080 : byte = $40; // Temp & Feuchte HDC1080
// CO2 : byte = $5A; // CO2 Sensor $5A oder $5B ? Fehler!
// DS : byte = $68; // HW-Clock

PCA : byte = $41; // 16 x PWM 12bit(0-4095) Freq. 25Hz ....15800Hz

Mode_Reg : byte = $01;
Result_Reg : byte = $02;
Start_Reg : byte = $F4;
// -----------------------------------------------------------------------------
Text : Array[0..40] of String[8] // fängt bei 0 an!!!
= ('001','4C3','1MSB','001078xx',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ','LIDAR F!');
// -----------------------------------------------------------------------------
WoDay : Array[0..6] of string[3]=('So.','Mo.','Di.','Mi.','Do.','Fr.','Sa.');
{----------------------------------------------------------------------}
{EEPROM}
var
{ Var Declarations }
{$IDATA}

LED [@PortD,2] : bit; // LED
Sig [@PortD,3] : bit; // Signal

// RES [@PortB,1] : bit; // CO2 HW-Reset (D09)
// WD [@PortD,3] : bit; // Watchdog Timer STWD100 (Puls 1usH>L>H)
// Mute [@PortB,2] : bit; // LS TE EIN/AUS (D10)
// Radar [@PinD, 5] : bit; // Radar Sensor Anlagenschutz (D05)
// Busy_F [@PinB, 3] : bit; // Busy Flag = 1 (Mp3 Player)) (D11)
// ----------------------------------------------------------------------------
var
n,count,stat,LB,C1,C2,C3,C4,C5,C6,C7,C8,C,ss,anz,I2 : byte;
schleife,CO2temp,status_R,stat_bin,Temp,I_,fr,x_,p_adr : byte;
hour,minute,secound,day,month,year,weekday,com,bef,pu_f : byte;
lbx,hbx,power_x,xe,power_b,n_,counter,play,h,l : byte;
STd_,Min_,ME_,Tag_,Jahr_,d_std,d_min,vol,ewa : byte;
WO,WC,NTC,LHL,LUX,CO2_,VOC_,LM35,ts,pw,pxc,u_akku,ima : word;
pxm,poff,Udiff;CT_,Udiff,Udig,LM35d,count_w,dt_,power : word;
ADC1,ADC2,ADC3,ADC4,ADC5,ADC6 : word;
HDC_T, HDC_H,step : float;
LW : LongWord;
br,hd : char;
lByArr[@LW] : Array[1..2] of byte;
CO2Array : Array[1..8] of byte;
I2Cbuff : Array[1..30]of byte;
BF : String[2];
clk : String[2];
DFP_ : string[8];
player : String[3];
ea : String[3];
ed : String[3];
{---------------------- Datenrichtungs Register -------------------------}
{ functions }
procedure Init_Ports; // 1 = Output
begin
// DDRB := %00000111; //

// DDRA := %00000000; //
DDRC := %00000000; //
DDRD := %00001100; // LED - Signal
//DDRF := %

// DDRF := %00000000;
end;
// -------------------------------------------------------------------------
procedure CR;
begin
write(serout,char(13)+char(10)); // CR & LF
end;
// -------------------------------- Timer --------------------------------------
procedure t_(s_t:word); // n x 1ms Timer!!
begin
repeat
dec(s_t);mdelay(1);
until s_t=0;
end;
// -----------------------------------Text -------------------------------------
procedure TXT(nr:byte); // Text Ausgabe
begin
Write(Serout,TEXT[nr]); // Ausgabe Text(nr)
end;
// -----------------------------------------------------------------------------
procedure LED_(ts:word);
begin
excl(LED); t_(ts); incl(LED);
end;
//-----------------------------------Signal ------------------------------------
procedure Sig_(ts:word); // Signal
begin
excl(Sig);t_(ts);incl(Sig); // H- > L
end;
// -------------------------------- PCA INIT -----------------------------------
procedure Init_PCA_; // OE = GND!
begin
if TWIstat(PCA) = true then // PCA9685 ok ?
write(serout,'PCA9685 ok! ADR: $41');CR;
fr:= 3; // 1600Hz
TWIOut(PCA,$00,$30); // Mode1 Adr. 00 sleep (wichtig!)
TWIOut(PCA,$FE,fr); // Prescale Reg. setze Freq (3 ~1700Hz)
TWIOut(PCA,$00,$20); // Mode1 Adr. 00 sleep A(wichti!g)
TWIOut(PCA,$01,$10); // NMOS($04) ohne Invert. ($10))!!
t_(25); // ein must! min 250ms
else // wait 200ms !
write(serout,'PCA9685 F!');CR;
endif;
end;
// ----------------------------------- INIT ------------------------------------ q
procedure PCA_Init_; // ohne invertierung!!
begin
TWIOut(PCA,$00,$30);TWIOut(PCA,$FE,fr);TWIOut(PCA,$01,$10);TWIOut(PCA,$00,0);
t_(10);
end;
// -------------------------------- PCA Reset ----------------------------------
procedure PCAR; // PCA Reset (Clear)
begin
TWIOut(PCA,$FA,$00);TWIOut(PCA,$FB,$00);TWIOut(PCA,$FC,$00);TWIOut(PCA,$FD,$00); // PCA clear
end;
// ----------------------------------------------
procedure PCA_R_;
begin
TWIOut(PCA,$00,$80);t_(5); // Restart 1000 0000
end;
// ---------------------------- PCA Adressen ------------------------------
procedure PCA_(adr:byte); // PWM Ports 1600Hz-0..4095(12bit)
begin
p_adr:= 4*adr+6; // 0 = 1 Adresse(6) M1!
lbx:=lo(pw);hbx:=hi(pw); // LB & HB
TWIOut(PCA,p_adr,lbx);TWIOut(PCA,p_adr+1,hbx); // ab Adresse 7!(0-15)!
end;
// -----------------------------------------------------------------------------
procedure PCA_up_down; // PWM 0-15 ON
begin
write(serout,'Count 0-15 UP');CR;
pw:=1;
for i_:=1 to 4 do
for n:=0 to 15 do
PCA_(n);t_(25);PCAR;t_(25); // R-G-B-Y-M C-W Check
endfor;
PCAR;
write(serout,'Count 15-0 down');CR;
for n:=15 downto 0 do // Time (ms)
PCA_(n);t_(25);PCAR;t_(25); // R-G-B-Y-M C-W Check
endfor;
endfor;
PCAR;
end;
// -----------------------------------------------------------------------------
procedure PCA_ud;
begin
PCAR;
write(serout,'UP/DOWN');CR;
for n:=1 to 6 do
for pw:=0 to 4095 do // up
lbx:=lo(pw);hbx:=hi(pw);
TWIOut(PCA,$FC,lbx);TWIOut(PCA,$FD,hbx);sdelay(3);
endfor;
t_(10);
for pw:=4095 downto 0 do
lbx:=lo(pw);hbx:=hi(pw);
TWIOut(PCA,$FC,lbx);TWIOut(PCA,$FD,hbx);sdelay(6);
endfor;
endfor;
pw:=0;PCAR;
end;
// ------------------------------------- -------------------------------------
procedure PCA_on_off; //all LED ON/OFF
begin
write(serout,'ON/OFF');CR;
for n_ := 0 to 40 do
TWIOut(PCA,$FB,$10);t_(25);PCAR;t_(50);
endfor;
PCAR;
end;
// ------------------------------------------------------------------------
Procedure PCA_Check_;
begin
write(serout,'PCA9685 INIT ~16kHz & Out(LED or NMOS');CR;
PCA_up_down; // enzelne LED's
PCA_ud;
PCA_on_off;
PCAR;
end;
// ------------------------------------ TON E/A --------------------------------
procedure ADC_Check_; // Verstärker E(1)/A(0)
begin
step:= 4.89; // Uref (5000mV / 1023
write(serout,'Step :'+floattostr(step:1:3));CR;
ADC1:= getadc(1);
ADC2:= getadc(2);
ADC3:= getadc(3);
ADC4:= getadc(4);
// ADC5:= getadc(5);
// ADC6:= getadc(6);
Write(serout,'ADC1 : '+inttostr(ADC1)+' U : '+floattostr(float(ADC1)*step :2)+'mV');CR;
Write(serout,'ADC2 : '+inttostr(ADC2)+' U : '+floattostr(float(ADC2)*step :2)+'mV');CR;
Write(serout,'ADC3 : '+inttostr(ADC3)+' U : '+floattostr(float(ADC3)*step :2)+'mV');CR;
Write(serout,'ADC4 : '+inttostr(ADC4)+' U : '+floattostr(float(ADC4)*step :2)+'mV');CR;
// Write(serout,'ADC5 : '+inttostr(ADC5:4)+' U : '+floattostr(float(ADC5)*step :2)+'mV');CR;
// Write(serout,'ADC6 : '+inttostr(ADC6:4)+' U : '+floattostr(float(ADC6)*step :2)+'mV');CR;
end;
// -----------------------------------------------------------------------------
procedure I2C_Check_; // Ermitteln von I2C Anschlüssen
begin
write(serout,' I2C-Check ');CR;
anz:=0;
for i2:=$02 to $FE do
if TWIstat(i2)= true then
inc(anz);t_(10); // Sensor found
write(serout,bytetostr(anz)+' Adressen : $'+bytetohex(i2));CR; // ok !
endif;
endfor;
write(serout,' Adressen : '+bytetostr(anz));CR;
end;
// ----------------------------------------------------------------------------
Procedure U_Akku_;
begin
U_Akku:=GetADC(3)div 10 *234; // U_akk in mV 12V = 12000mV
Udig:=GetADC(3);
write(serout,'Spannung : '+inttostr(U_Akku div 10 :2:2)+'V Udig '+inttostr(Udig));CR;
end;
//--------------------------- LED R-G-B-Y-M-C-W -------------------------------
procedure RGB(color:byte;pxc:word;t_sw:word); // RGB Leuchtband Check
begin
pw:=pxc; // wichtig
case color of
1 : PCA_(8)| // red (2x) start Code(Service)
2 : PCA_(9)| // grn !!! Leitungen!! am LED Band
3 : PCA_(10)| // blue
4 : PCA_(8);PCA_(9)| // yellow
5 : PCA_(8);PCA_(10)| // magenta
6 : PCA_(9);PCA_(10)| // cyan
7 : PCA_(8);PCA_(9);PCA_(10)| // white
endcase; // 25ms -> xxx ms
pw:=0;PCA_(08);PCA_(09);PCA_(10); // Reset R-G-B R_G-B Aus
end;
//----------------------------------------------------------------------------------
procedure B_Reg; // App Funktionen!(Befehle)
begin
if serstat = true then // an RX Zeichen?
read(SerInp, BF);
if BF='ad' then ADC_Check_;endif; // ADC Check 1-6 // Infos
if BF='pc' then PCA_Check_;endif; // PCA Check =end! ~1600hz (4094 max) non invert
if BF='sr' then system_reset;endif; // System Reset
if BF='si' then Sig_(100);endif; // Signal Buzzer
if BF='ld' then LED_(200);endif; // LED rt 100ms
if BF='i2' then I2C_Check_;endif; // TWI Check
FlushBuffer(RxBuffer);
endif;
end;
// ***************************************************************************
begin
EnableInts; // Interrupt zulassen
init_Ports; // Set Ports I/O
write(serout,'--- PCA - ADC - LED - Sig Check ---');CR;
init_PCA_;
// PCA_Check_;
// PCA_up_down; // enzelne LED's
// PCA_ud;
// PCA_on_off; // PCA LED Check
LED_(100);Sig_(50); //
// -----------------------------------------------------------------
loop
t_(10); // 1ms!! tick-Timer ~10ms
B_Reg; // Befehls Register
endloop;
End MC4808_Check_03.
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1362
Registered: 03 / 2005
Subject:

Re: UDPI and standard Drivers

 · 
Posted: 25.10.2021 - 21:16  ·  #4
Thanks Toni
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1362
Registered: 03 / 2005
Subject:

Beta Update

 · 
Posted: 10.12.2021 - 11:16  ·  #5
Hello Beta Testers.

First of all, thank you all for feedback. A new set of files attached.

IMPORTANT
==========

At the moment the ProcClock must be divided by 6 to give correct results e.g. for serial. I am looking into this at the moment.

Changes
=======

Serial ports 1-4 activated.
Assembler updated to support UPDI chips
DSC files corrected for pDataStart and pDataEnd, and also for UPDI devices, corrected for Serial.
A to D conversion - small bug fixed
Also various non-UDPI issues fixed, particularly in Optimiser

========================================================================

Hallo Beta-Tester.

Zunächst einmal danke ich euch allen für euer Feedback. Ein neuer Satz von Dateien ist beigefügt.

WICHTIG
==========

Im Moment muss die ProcClock durch 6 geteilt werden, um korrekte Ergebnisse z.B. für Serien zu erhalten. Ich bin gerade dabei, dies zu überprüfen.

Änderungen
=======

Serielle Schnittstellen 1-4 aktiviert.
Assembler aktualisiert, um UPDI-Chips zu unterstützen
DSC-Dateien korrigiert für pDataStart und pDataEnd, und auch für UPDI-Geräte, korrigiert für Serial.
A nach D Konvertierung - kleiner Fehler behoben
Auch verschiedene Nicht-UDPI-Probleme behoben, insbesondere im Optimiser

Übersetzt mit www.DeepL.com/Translator (kostenlose Version)

=============================================================

Merlin
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1362
Registered: 03 / 2005
Subject:

Re: UDPI and standard Drivers

 · 
Posted: 04.01.2022 - 22:14  ·  #6
The previous Beta is now v5.11.03

I now have a new beta, which changes how the oscillator is defined for UPDI devices. ProcClock is now obsolete. Instead are optional defines for OscType and CLKDiv, which if not defined default to 20MHz with a divisor factor of 6 to give the CLKPER value which is used for serial comms etc. A file DocuUPDI in the attached zip file explains the options (English an German versions included).

Also included is an improved Optimiser.

===========================================

Die vorherige Beta ist jetzt v5.11.03

Ich habe jetzt eine neue Beta, die ändert, wie der Oszillator für UPDI-Geräte definiert ist. ProcClock ist nun überflüssig. Stattdessen gibt es optionale Definitionen für OscType und CLKDiv, die, wenn sie nicht definiert sind, standardmäßig 20MHz mit einem Teilerfaktor von 6 haben, um den CLKPER-Wert zu erhalten, der für serielle Kommunikation usw. verwendet wird. Eine Datei DocuUPDI in der angehängten Zip-Datei erklärt die Optionen (englische und deutsche Versionen enthalten).

Ebenfalls enthalten ist ein verbesserter Optimierer.

Übersetzt mit www.DeepL.com/Translator (kostenlose Version)
golf
Benutzer
Avatar
Gender:
Location: Donauwörth
Age: 70
Posts: 250
Registered: 11 / 2009
Subject:

Re: UDPI and standard Drivers

 · 
Posted: 05.01.2022 - 06:30  ·  #7
Hi Merlin,
the file DocuUPDI in the attached zip file is missing.

golf
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1362
Registered: 03 / 2005
Subject:

Re: UDPI and standard Drivers

 · 
Posted: 05.01.2022 - 09:25  ·  #8
Sorry golf.

Corrected zip file attached.

Also attached (so you don't need to download everything) is DOCs.zip which just contains the DocuUPDI files. (The Beta.zip also contains these documents)

Thanks for bringing is to my attention.
  • 1
  • 2
  • 3
  • 4
  • Page 1 of 4
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   135   149 · Page-Gen-Time: 0.024698s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI