You are here

Another problem with SPI [SOLVED] | Cypress Semiconductor

Another problem with SPI [SOLVED]

Summary: 6 Replies, Latest post by Bob Marlowe on 16 Sep 2016 01:20 AM PDT
Verified Answers: 1
Last post
Log in to post new comments.
user_365962704's picture
User
209 posts

Hi,

Some time ago i did a project and used SPI_txBufferRead and SPI_rxBufferRead variables to know where in the FIFO buffer i "was".

  • SPI_txBufferRead = Transmits buffer location of the last data read from the buffer and transmitted by SPI Master hardware.
  • SPI_rxBufferRead = Receives buffer location of the last data read from the buffer by the API.

(This information is at the end of the page 20 of the current SPI Datasheet.)

Now i'm trying to use the same variables and Creator gives me an error "Build error: 'SPI_txBufferRead' undeclared (first use in this function)"

After some checking theres an "announcement" at the end of the SPI.h file:

------------------------------------------------------------------------------------------------------------------------------------------------------------------

/***************************************
* The following code is DEPRECATED and
* should not be used in new projects.
***************************************/

#define SPI_WriteByte   SPI_WriteTxData
#define SPI_ReadByte    SPI_ReadRxData
void  SPI_SetInterruptMode(uint8 intSrc)       ;
uint8 SPI_ReadStatus(void)                     ;
void  SPI_EnableInt(void)                      ;
void  SPI_DisableInt(void)                     ;

#define SPI_TXDATA                 (SPI_TXDATA_REG)
#define SPI_RXDATA                 (SPI_RXDATA_REG)
#define SPI_AUX_CONTROLDP0         (SPI_AUX_CONTROL_DP0_REG)
#define SPI_TXBUFFERREAD           (SPI_txBufferRead)
#define SPI_TXBUFFERWRITE          (SPI_txBufferWrite)
#define SPI_RXBUFFERREAD           (SPI_rxBufferRead)
#define SPI_RXBUFFERWRITE          (SPI_rxBufferWrite)

------------------------------------------------------------------------------------------------------------------------------------------------------------------

and there's SPI_txBufferRead :/.

 

So, there's any new way to know in what position of the FIFO i'm?

I need to use it know because i'm having some problems with those FIFOs.

 

Thanks in advance

Carlos

BTW i'm using CY8CKIT-059 kit

 

user_1377889's picture
User
10400 posts

When you do not specify a buffer the variables will not exist. The SPI_rxBufferRead will not point into the FIFO which exists as real hardware. When the buffer defined exceeds the fifo size, an internal SPI-interrupt will fetch the data from fifo and store them in a circular buffer. The position within the buffer is reflected by SPI_rxBufferRead variable.

 

Bob

user_365962704's picture
User
209 posts

So (if i understand right), if my FIFO buffer is 4 bytes depth i'm unable to use that variables?

Well, it's a shame ;(, i think i will need to do a real debug instead of just printing stuff out, problem is the PSoC need to be running at 3.3v, i think the only way (without buying a MiniProg) to debug it is using the PSoC 4 Pioneer kit configured at that voltage. By any chance do you know the part number of the debug connectors on the board?

Thanks for the info Bob, i'm always learning from your posts :D.

Carlos

user_1377889's picture
User
10400 posts

So (if i understand right), if my FIFO buffer is 4 bytes depth i'm unable to use that variables? That's right.

problem is the PSoC need to be running at 3.3v, Why a problem? There is some information in the Kitprog manual afaik (or was it the Kit manual) concerning different voltage. There was a diode that was needed to be removed and the 3.3V must be provided separately. Check the manuals by searching for "3.3".

 

Bob

user_365962704's picture
User
209 posts

Found it:

§ 4.2.3 Power Supply System

...

Note: In order to use an external power supply, while KitProg is connected to the PCB USB, remove
diode, D1, from the board. This ensures that VTARG supply from KitProg is not supplied to the target
device. KitProg measures the target voltage and adjusts the logic levels on the programming pins
accordingly.

...

Will remove the D1 diode and come back if i have any problem.

Carlos

PD: I even found a video https://www.youtube.com/watch?v=0UMXdJHwh_U

user_365962704's picture
User
209 posts

Well, just for update i were able to debug the PSoC 5LP after removing the D1 diode and providing 3.3v to the kit via external power supply. Also changed the PSoC working voltages on the system tab.

Thanks for the help

Carlos

user_1377889's picture
User
10400 posts

Great!

 

Bob

Log in to post new comments.