- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Community,
I am trying to check the operation of SPI Master only on CYBLE-012011-EVAL board.
I am referring to @MotooTanaka 's program for PSoC4.
However, in the Top design view, the SPI component m_miso is an error and I cannot build.
The error message is : Terminal "m_miso" requires connection when it is visible.
What should I do to resolve this error?
Best Regards,
Chihiro Tatebayashi
Solved! Go to Solution.
- Labels:
-
Legacy Microcontrollers
- Tags:
- CYBLE-012011-EVAL
- spi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I just created an empty project for CYBLE-012011.
I modified the SCB1 to SPIM.
Although no code has been written, the project is compile-able.
So please start with this project and port the SPI part from the example to meet your requirement.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Tanaka - san
=========================Incomplete program===========================
#include "project.h"
#include "stdio.h"
#define TIMEOUT_MS 1000
#define TX_BUF_LEN 32
#define RX_BUF_LEN 32
char str[128];
void print (char *str)
{
UART_UartPutString(str);
}
void init_hardware(void)
{
CyGlobalIntEnable;
UART_Start();
SPIM_Start();
}
void splash(void)
{
sprintf(str, "SPIM Loop Back Test (%s %s)\n", __DATE__, __TIME__ );
print(str);
}
int main (void)
{
int offset = 0 ;
int i ;
uint8_t tx_buf[TX_BUF_LEN] ;
uint8_t rx_buf[RX_BUF_LEN] ;
int tx_count, rx_count ;
int num_to_send = 8 ;
int timeout_count = 1000 ;
init_hardware() ;
splash() ;
for(;;)
{
for (i = 0 ; i < num_to_send ; i++ ) {
tx_buf[i] = offset + i ;
}
tx_count = num_to_send ; /* send data*/
SPIM_SpiUartPutArray(tx_buf,tx_count);
while(SPIM_SpiUartGetTxBufferSize() > 0)
{
timeout_count++;
if(timeout_count >= TIMEOUT_MS)
{
print("SPIM Sending Timeout!\n\r");
break ;
}
CyDelay(1);
}
/*recive data*/
rx_count = 0;
while(SPIM_SpiUartGetRxBufferSize() > 0)
{
rx_buf[rx_count] = SPIM_SpiUartReadRxData();
rx_count++;
if(rx_count >= RX_BUF_LEN)
{
break;
}
}
print("Data Sent: ");
for(i = 0; i < tx_count ; i++)
{
sprintf(str, "%02X ", tx_buf[1]);
print(str);
}
print("\n\r");
print("Data Recieved: ");
for ( i = 0; i < rx_count; i++){
sprintf(str, "%02X", rx_buf[1]);
print(str);
}
print("\n\r");
CyDelay(2000);
offset++;
if(offset >= 20)
{
offset = 0;
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In your schematic, MISO seems to be connected to a constant "0".
For a loopback test, how about remove the constant and connect MISO to MOSI in the schematic?
So that you don't have to modify the hardware.
And if loopback test works, you should bring the MISO pin to the external pin for real data receiving.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Tanaka - san
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
When MISO has input source from MOSI, it should not be connected to a pin.
So pleaset test without MISO pin.
Or delete wire between MOSI and MISO, then connect MOSI and MISO using external Pins with external jumper wire.
moto