si5351 UT working, commented out printfs
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 7 Jun 2016 08:09:39 +0000 (08:09 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 7 Jun 2016 08:09:39 +0000 (08:09 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2817 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/stm32/Makefile
codec2-dev/stm32/src/si5351_ut.c
codec2-dev/stm32/src/si53xx.c

index f3a1fe9bed00e1fbd32386663e5e0433c2e980f1..5a8dd7ed122ef90a46f2f3b095e15af63c9aba7a 100644 (file)
@@ -809,7 +809,6 @@ fm_loduc_play.elf: $(FM_LODUC_PLAY_SRCS) src/stm32f4_dacloduc.o
 # ---------------------------------------------------------------------------------
 
 SI5351_UT_SRCS=\
-gdb_stdio.c \
 src/si5351_ut.c \
 src/new_i2c.c \
 src/si53xx.c \
index 953c623771d13b4b35b2d73f4c93a224bab5738a..cd07d49da44022d8851b1119385ca850c2f3c9c1 100644 (file)
 #include <assert.h>
 #include "new_i2c.h"
 #include "si53xx.h"
-#include "gdb_stdio.h"
-
-#define printf gdb_stdio_printf
+//#include "gdb_stdio.h"
+//#define printf gdb_stdio_printf
 
 int main(void) {
     int ret;
 
-    printf("starting\n");
+    //printf("starting\n");
     I2C_Setup();
     si5351_init(0, SI5351_CRYSTAL_LOAD_6PF, 0);
-    
     ret = si5351_set_freq(1000000000ULL, 0, SI5351_CLK0);
-    printf(" ret = %d\n", ret);
+    //printf(" ret = %d\n", ret);
 
     while(1);
 }
index 2876c1881bb9c0d515aad698467b7ed8246ec71c..8181fbd74305e0a71f02039a71890ca974355cdc 100644 (file)
 #include "math.h"
 #include "si53xx.h"
 
-#include "gdb_stdio.h"
-#define printf gdb_stdio_printf
-
 
 void si5351_write(uint8_t REGaddr, uint8_t data) {
     // ignoring errors
     // Waiting for the bite
     Si5351_Config.I2C_ErrorCode=I2C_NewWriteRegister(Si5351_Config.I2C_add, REGaddr, data);
+
+    /*
     printf("  si5351_write: REGaddr: 0x%02x data...: 0x%02x", REGaddr, data);
     if (Si5351_Config.I2C_ErrorCode > 0xff)
         printf("  ErrorCode: 0x%02x\n", Si5351_Config.I2C_ErrorCode);
     else
         printf("\n");
+    */
 }
 
 void si5351_write_bulk(uint8_t REGaddr, uint8_t bytes, uint8_t *data) {
@@ -65,14 +65,14 @@ void si5351_write_bulk(uint8_t REGaddr, uint8_t bytes, uint8_t *data) {
 uint8_t si5351_read(uint8_t REGaddr) {
     uint8_t reg_val;
     Si5351_Config.I2C_ErrorCode=I2C_NewReadRegister(Si5351_Config.I2C_add,REGaddr);
-    printf("  si5351_read.: REGaddr: 0x%02x", REGaddr);
+    //printf("  si5351_read.: REGaddr: 0x%02x", REGaddr);
     if (Si5351_Config.I2C_ErrorCode>0xff) {
         reg_val=0;
-        printf(" ErrorCode: 0x%02x\n", Si5351_Config.I2C_ErrorCode);
+        //printf(" ErrorCode: 0x%02x\n", Si5351_Config.I2C_ErrorCode);
     } else {
         reg_val=(uint8_t)(Si5351_Config.I2C_ErrorCode & 0xff);
         Si5351_Config.I2C_ErrorCode=0;
-        printf(" reg_val: 0x%02x\n", reg_val);
+        //printf(" reg_val: 0x%02x\n", reg_val);
     }
     return reg_val;
 }
@@ -93,7 +93,7 @@ uint8_t si5351_read(uint8_t REGaddr) {
  *------------------------------------------------------------------------------
  */
 void si5351_init(uint8_t I2C_Address, uint8_t xtal_load_c, uint32_t ref_osc_freq) {
-    printf("si5351_init\n");
+    //printf("si5351_init\n");
 
     Si5351_Config.clk0_freq=0;
     Si5351_Config.lock_plla = SI5351_CLKNONE;
@@ -116,7 +116,7 @@ void si5351_init(uint8_t I2C_Address, uint8_t xtal_load_c, uint32_t ref_osc_freq
 
     // DR: test of I2C
     reg_val = si5351_read(SI5351_CRYSTAL_LOAD);
-    printf("reg_val: 0x%02x\n", reg_val);
+    //printf("reg_val: 0x%02x\n", reg_val);
 
     // Change the ref osc freq if different from default
     // Divide down if greater than 30 MHz
@@ -178,7 +178,7 @@ uint8_t si5351_set_freq(uint64_t freq, uint64_t pll_freq, enum si5351_clock clk)
     uint8_t int_mode = 0;
     uint8_t div_by_4 = 0;
 
-    printf("si5351_set_freq:\n");
+    //printf("si5351_set_freq:\n");
 
     // PLL bounds checking
     if(pll_freq != 0) {
@@ -188,7 +188,7 @@ uint8_t si5351_set_freq(uint64_t freq, uint64_t pll_freq, enum si5351_clock clk)
         }
     }
 
-    printf("freq: 0x%0x 0x%0x\n", (uint32_t)(freq >> 32), (uint32_t)(freq & 0xffffffff));
+    //printf("freq: 0x%0x 0x%0x\n", (uint32_t)(freq >> 32), (uint32_t)(freq & 0xffffffff));
 
     // Lower bounds check
     if(freq < SI5351_CLKOUT_MIN_FREQ * SI5351_FREQ_MULT) {
@@ -200,7 +200,7 @@ uint8_t si5351_set_freq(uint64_t freq, uint64_t pll_freq, enum si5351_clock clk)
         freq = SI5351_MULTISYNTH_MAX_FREQ * SI5351_FREQ_MULT;
     }
 
-    printf("freq: 0x%0x 0x%0x\n", (uint32_t)(freq >> 32), (uint32_t)(freq & 0xffffffff));
+    //printf("freq: 0x%0x 0x%0x\n", (uint32_t)(freq >> 32), (uint32_t)(freq & 0xffffffff));
 
     // Select the proper R div value
     r_div = si5351_select_r_div(&freq);
@@ -241,14 +241,14 @@ uint8_t si5351_set_freq(uint64_t freq, uint64_t pll_freq, enum si5351_clock clk)
         // Only good for Si5351A3 variant at the moment
         switch(clk) {
             case SI5351_CLK0:
-                    printf("case SI5351_CLK0\n");
+                    //printf("case SI5351_CLK0\n");
                     pll_freq = si5351_multisynth_calc(freq, 0, &ms_reg);
                     target_pll = SI5351_PLLA;
                     write_pll = 1;
                     si5351_set_ms_source(SI5351_CLK0, SI5351_PLLA);
 
-                    printf("pll_freq: 0x%0x 0x%0x\n", (uint32_t)(pll_freq >> 32), (uint32_t)(pll_freq & 0xffffffff));
-                    printf("freq: 0x%0x 0x%0x\n", (uint32_t)(freq >> 32), (uint32_t)(freq & 0xffffffff));
+                    //printf("pll_freq: 0x%0x 0x%0x\n", (uint32_t)(pll_freq >> 32), (uint32_t)(pll_freq & 0xffffffff));
+                    //printf("freq: 0x%0x 0x%0x\n", (uint32_t)(freq >> 32), (uint32_t)(freq & 0xffffffff));
 
                     Si5351_Config.plla_freq = pll_freq;
                     Si5351_Config.clk0_freq = freq;