Having trouble with Control Reg component

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
DaHu_285096
Level 5
Level 5
10 likes received 250 replies posted 100 replies posted

 Hi,

   

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;

   

 

   

  SPI_SELECT_Write(RTC_SEL);

   

  writeSPI( RTCREAD + regSECOND); // write command

   

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

   

  {

   

    tbuf = writeSPI(0);   

   

  }

   

  SPI_SELECT_Write(RTC_SEL);

   

  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;

   

}

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

   

 

   

Bob 

0 Likes
DaHu_285096
Level 5
Level 5
10 likes received 250 replies posted 100 replies posted

 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. 

   

Regards 

   

David

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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.

   

 

   

Bob

0 Likes