[sigrok-devel] sigrok decoder for AD9833 programmable waveform generator

2020-10-28 Thread Martin Homuth-Rosemann

Hello,

PFA a decoder for the AD9833 (Analog Devices Programable Waveform 
Generator). This device is programmed via SPI and allows the generation 
of sine, triangle or square signal. Cheap modules are available from China.

I've packed the decoder, a demo sample with README and a test case.

Please check if you need more input.

Martin


AD9833_decoder.tgz
Description: application/compressed-tar
___
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel


[sigrok-devel] Submitting again: Fix calibration frequency for scopes

2020-10-27 Thread Martin Homuth-Rosemann

Hi Uwe, hi sigrok team,

Just a reminder - I've submitted this fix for FX2 based scopes already 
half a year ago.
If you do not like the extra frequencies, please correct at least the 
100, 1000 and 1 Hz values, 50 kHz doesn't work with 12 MHz CPU clock.
Easy fix: The settings of RCAP2 must be half as big in function "static 
BOOL set_calibration_pulse(BYTE fs)"

https://github.com/sigrokproject/sigrok-firmware-fx2lafw/blob/b6ec4813b592757e39784b9b370f3b12ae876954/include/scope.inc#L265
There is also a small typo in line 276 (comment should read "10kHz").

Martin


 Weitergeleitete Nachricht 
Betreff:Fix calibration frequency for scopes
Datum:  Tue, 7 Apr 2020 21:01:37 +0200
Von:Martin Homuth-Rosemann 
An: sigrok-devel@lists.sourceforge.net



Hi Uwe, hi sigrok team,

The initial setting of the calibration frequency output (1 kHz)of the 
FX2-based scopes is ok, but as soon as the user sets the frequency via 
'set_calibration_pulse()' the output frequency is only half the 
requested value, probably due to a recent change of CPU_FREQ from 24 to 
12 MHz. The settings of RCAP2 must be half as big (see also 
https://github.com/sigrokproject/sigrok-firmware-fx2lafw/commit/14728a53624f000db0fa8388ecdb8b021250322b).


Martin

PFA the patch that fixes the behaviour and adds also more frequency 
choices (this is used in my OpenHantek6022 project).




--- a/include/scope.inc
+++ b/include/scope.inc
@@ -263,24 +263,54 @@ static BOOL set_samplerate(BYTE rate)
 }
 
 static BOOL set_calibration_pulse(BYTE fs)
-{
+{ // values for CLK_12M
 	switch (fs) {
-	case 0:		// 100Hz
+	case 105:	// 50Hz
 		RCAP2L = -1 & 0xff;
 		RCAP2H = (-1 & 0xff00) >> 8;
 		return TRUE;
-	case 1:		// 1kHz
+	case 106:	// 60Hz
+		RCAP2L = -8333 & 0xff;
+		RCAP2H = (-8333 & 0xff00) >> 8;
+		return TRUE;
+	case 0:		// 100Hz
+	case 110:	// 100Hz
+		RCAP2L = -5000 & 0xff;
+		RCAP2H = (-5000 & 0xff00) >> 8;
+		return TRUE;
+	case 120:	// 200Hz
+		RCAP2L = -2500 & 0xff;
+		RCAP2H = (-2500 & 0xff00) >> 8;
+		return TRUE;
+	case 150:	// 500Hz
 		RCAP2L = -1000 & 0xff;
 		RCAP2H = (-1000 & 0xff00) >> 8;
 		return TRUE;
-	case 10:	// 1kHz
-		RCAP2L = (BYTE)(-100 & 0xff);
+	case 1:		// 1kHz
+		RCAP2L = -500 & 0xff;
+		RCAP2H = (-500 & 0xff00) >> 8;
+		return TRUE;
+	case 2:		// 2kHz
+		RCAP2L = -250 & 0xff;
+		RCAP2H = (-250 & 0xff00) >> 8;
+		return TRUE;
+	case 5:		// 5kHz
+		RCAP2L = -100 & 0xff;
+		RCAP2H = (-100 & 0xff00) >> 8;
+		return TRUE;
+	case 10:	// 10kHz
+		RCAP2L = (BYTE)(-50 & 0xff);
 		RCAP2H = 0xff;
 		return TRUE;
-	case 50:	// 50kHz
-		RCAP2L = (BYTE)(-20 & 0xff);
+	case 20:	// 20kHz
+		RCAP2L = (BYTE)(-25 & 0xff);
 		RCAP2H = 0xff;
 		return TRUE;
+// setting for 50 kHz doesn't work, gives 25 kHz (interrupt fires too often?)
+//	case 50:	// 50kHz
+//		RCAP2L = (BYTE)(-10 & 0xff);
+//		RCAP2H = 0xff;
+//		return TRUE;
 	default:
 		return FALSE;
 	}

___
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel


[sigrok-devel] Fix calibration frequency for scopes

2020-04-07 Thread Martin Homuth-Rosemann

Hi Uwe, hi sigrok team,

The initial setting of the calibration frequency output (1 kHz)of the 
FX2-based scopes is ok, but as soon as the user sets the frequency via 
'set_calibration_pulse()' the output frequency is only half the 
requested value, probably due to a recent change of CPU_FREQ from 24 to 
12 MHz. The settings of RCAP2 must be half as big (see also 
https://github.com/sigrokproject/sigrok-firmware-fx2lafw/commit/14728a53624f000db0fa8388ecdb8b021250322b).


Martin

PFA the patch that fixes the behaviour and adds also more frequency 
choices (this is used in my OpenHantek6022 project).



--- a/include/scope.inc
+++ b/include/scope.inc
@@ -263,24 +263,54 @@ static BOOL set_samplerate(BYTE rate)
 }
 
 static BOOL set_calibration_pulse(BYTE fs)
-{
+{ // values for CLK_12M
 	switch (fs) {
-	case 0:		// 100Hz
+	case 105:	// 50Hz
 		RCAP2L = -1 & 0xff;
 		RCAP2H = (-1 & 0xff00) >> 8;
 		return TRUE;
-	case 1:		// 1kHz
+	case 106:	// 60Hz
+		RCAP2L = -8333 & 0xff;
+		RCAP2H = (-8333 & 0xff00) >> 8;
+		return TRUE;
+	case 0:		// 100Hz
+	case 110:	// 100Hz
+		RCAP2L = -5000 & 0xff;
+		RCAP2H = (-5000 & 0xff00) >> 8;
+		return TRUE;
+	case 120:	// 200Hz
+		RCAP2L = -2500 & 0xff;
+		RCAP2H = (-2500 & 0xff00) >> 8;
+		return TRUE;
+	case 150:	// 500Hz
 		RCAP2L = -1000 & 0xff;
 		RCAP2H = (-1000 & 0xff00) >> 8;
 		return TRUE;
-	case 10:	// 1kHz
-		RCAP2L = (BYTE)(-100 & 0xff);
+	case 1:		// 1kHz
+		RCAP2L = -500 & 0xff;
+		RCAP2H = (-500 & 0xff00) >> 8;
+		return TRUE;
+	case 2:		// 2kHz
+		RCAP2L = -250 & 0xff;
+		RCAP2H = (-250 & 0xff00) >> 8;
+		return TRUE;
+	case 5:		// 5kHz
+		RCAP2L = -100 & 0xff;
+		RCAP2H = (-100 & 0xff00) >> 8;
+		return TRUE;
+	case 10:	// 10kHz
+		RCAP2L = (BYTE)(-50 & 0xff);
 		RCAP2H = 0xff;
 		return TRUE;
-	case 50:	// 50kHz
-		RCAP2L = (BYTE)(-20 & 0xff);
+	case 20:	// 20kHz
+		RCAP2L = (BYTE)(-25 & 0xff);
 		RCAP2H = 0xff;
 		return TRUE;
+// setting for 50 kHz doesn't work, gives 25 kHz (interrupt fires too often?)
+//	case 50:	// 50kHz
+//		RCAP2L = (BYTE)(-10 & 0xff);
+//		RCAP2H = 0xff;
+//		return TRUE;
 	default:
 		return FALSE;
 	}
___
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel


[sigrok-devel] Pull request sigrok-firmware-fx2lafw: bugfix in hantek 6022BL voltage range selection #2

2019-04-23 Thread Martin Homuth-Rosemann

Hi,

I have found this pull request, which has been available for some time now:
https://github.com/sigrokproject/sigrok-firmware-fx2lafw/pull/2/commits/1e4f9813bd749eb091430ab4347091020445442e
Please check if this patch can be pulled.

Martin



___
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel