Another problem with SPI [SOLVED]

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

cross mob
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

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

0 Likes
1 Solution
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

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

View solution in original post

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

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

0 Likes
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

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

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

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

0 Likes
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

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

0 Likes
cadi_1014291
Level 6
Level 6
25 likes received 10 likes received 10 likes given

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

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

Great!

   

 

   

Bob

0 Likes