3 Replies Latest reply on Aug 7, 2014 6:13 AM by JoMe_264151

    Having trouble with Control Reg component




      I am trying to use a control reg (v1.7 in Creator 3) to drive a demultiplexer for Chip select on a couple of devices for SPI application.


      The problem is that the compiler complains that reference is not found for the component. The project is attached.


      The component is named "SPI_SELECT" and this is my code. RTC-SEL is defined as "1", 


      struct Timetype GetTime(void)




          struct Timetype t;


          unsigned char tbuf[8];


          unsigned char i;






        writeSPI( RTCREAD + regSECOND); // write command


        for (i = 0; i<7; i++)




          tbuf[i] = writeSPI(0);   






        t.Second = tbuf[0] & 0x7f;


        t.Minute = tbuf[1] & 0x7f;


        t.Hour = tbuf[2] & 0x3f;


        t.Day = tbuf[3] & 0x3f;


        t.Month = tbuf[5] & 0x1f;


        t.Year = tbuf[6];


        return t;



        • 1. Re: Having trouble with Control Reg component

          Hard-to-find error!


          Since your MEM_CS and RTC_CS pins do not have got a hardware connection (Configure-dialog) they were not connected to your multiplexor's output lines. Thus all the unneeded components were optimized-out. That happened to your status-register, look into the generated .c-file it shows that it was optimized-out.


          Set the pin's properties to "Hardware Connection" and re-draw your wires, that will work





          • 2. Re: Having trouble with Control Reg component

             Thanks Bob,


            I was not aware that was occurring. I'll set them to hardware.


            By the way, Do we need to invert the SS output of SPI for Active Low ICs?




            Also, while I have your attention, do you know if there is any generic programming documention on Cypress. I had a bit of trouble with scope today when splitting my code fragments into their own C files with header files. 





            • 3. Re: Having trouble with Control Reg component

              Since Cypress - C is GNU CC there is no general programming manual.


              The ss-output is active-high, so you should invert the signal for an active-low device. The inversion of the component's ss signal is used to distinguish a signal from a not-multiplexed level.