- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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