PSoC 6 WIFI-BT Pioneer Kit: how to find free pins to connect to SCB UART ?

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

cross mob
brandiware
Level 4
Level 4
First like given 25 sign-ins 5 solutions authored

Hello Cypress,

I am trying to use an SCB UART but it is very hard to find a suitable and free pin to connect to. For example P3.0 and P3.1 would be suitable, according to the device configurator. Yet, I cannot find P3.1 on the breakout board !

Can you please suggest suitable pins to utilize an SCB UART for an external RS232 connection ?

Any help is greatly appreciated.

Regards,

Stefan

0 Likes
1 Solution

The pins 8.0 and 8.1 can be assigned to the UART of scb4. Some modifications must be done on the breakout to disconnect respective CAPSENSE hardware. See KIT Documentation page 48.

View solution in original post

0 Likes
7 Replies
SuSh_1535366
Level 5
Level 5
Distributor - Macnica (Japan)
10 solutions authored 10 likes given 10 likes received

Hi,

On page 44 of the Pioneer Kit guide, which you can download from here , there is a description of the PSoC6 ports and their respective uses.

If you only need TX/RX to be used as UART, then P10[1:0] or P13[1:0] can be used.
If you need more CTS/RTS, P10[3:0] is the only pin you can use via the Auduino header.
(For the other ports, you will need to modify the board by removing components on the board.)

Regards,

Shima

0 Likes

Hi Shima,

as we are using the TFT Shield these PINs are used (A0-A5) I believe, at least

the shield is plugged there. Maybe the pins are not used for the TFT Shield ? Based on the device configurator, only a handful of PINs can  be used in the SCB UARTs. We still cannot find the PIN 3.1 which would be available in the  according SCB Block. Why is it not depicted on Page 44 ?

Thanks

0 Likes
SuSh_1535366
Level 5
Level 5
Distributor - Macnica (Japan)
10 solutions authored 10 likes given 10 likes received

Hi,

If you are using TFT shields then P10 and P13 are not available.

And P3[1:0] is connected to the WiFI/BT module on Pioneer kit, so you cannot find it on the board.

Please refer to the schematic which can be downloaded from the same place as the URL I wrote before.
From the schematic, look for where the UART pins can be taken out with a simple modification.

Regards,
Shima

0 Likes

thanks Shima, I have already done this - taking out some of the Capsense functionality to get P8.0 and P8.1 freed for the UART. Could you, by any chance, point me to a recent ModusToolbox example project for an SCB UART transmit and receive ? not using the built in USB-UART bridge

Thanks and Cheers

Stefan

0 Likes
SuSh_1535366
Level 5
Level 5
Distributor - Macnica (Japan)
10 solutions authored 10 likes given 10 likes received

Hi Stefan,

I think you can get the sample code to use the SCB UART by going to:
modus toolbox -> new Application -> choose CY8CKIT-062-Wifi-BI bsp -> check UART Transmit and Receive.

In the sample code, P5[1:0] (for KitProg2 USB-UART bridge) is assigned to UART, so you can change it to P8[1:0].

Regards,
Shima

0 Likes

Hi Shima,

I was aware of that example, unfortunately it is limited to the use of the 

result = cy_retarget_io_init(CYBSP_DEBUG_UART_TX, CYBSP_DEBUG_UART_RX,
CY_RETARGET_IO_BAUDRATE);

and the default UART on SCB5.

I have an UART configured on SCB4 and I am trying to get it to work.

 

Please see the attached source on the initialization. The Init func is called in main() before the IRQ are enabled. I then use

(void) Cy_SCB_UART_Transmit(scb_4_HW, txBuffer, sizeof(txBuffer), &uartContext);
/* Blocking wait for transmission completion */
while (0UL != (CY_SCB_UART_TRANSMIT_ACTIVE & Cy_SCB_UART_GetTransmitStatus(scb_4_HW, &uartContext)))
{
}

which seems to work. However after that I cannot get a receipt and rather get an error from somewhere

Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0xb4e50a40

the program halts at 

configASSERT( xTaskToNotify != NULL );

 

Maybe your experienced eye can spot a problem ? Any working example of an actual SCB UART implementation outside of the SCB5 default UART would be very much appreciated.

 

Thanks

Stefan

 

/* Allocate context for UART operation */
cy_stc_scb_uart_context_t uartContext;
static TaskHandle_t xTaskToNotify = NULL;

char rxBuffer[UART_BUFFER_SIZE];

void initUART() {

/* Set up the device based on configurator selections */
init_cycfg_all();

/* Configure UART to operate */
(void) Cy_SCB_UART_Init(scb_4_HW, &scb_4_config, &uartContext);


/* Populate configuration structure (code specific for CM4) */
cy_stc_sysint_t uartIntrConfig =
{
.intrsrc=UART_INTR_NUM,
.intrPriority = UART_INTR_PRIORITY,
};
/* Hook interrupt service routine and enable interrupt */
(void) Cy_SysInt_Init(&uartIntrConfig, &UART_Isr);
NVIC_EnableIRQ(UART_INTR_NUM);


/* Enable UART to operate */
Cy_SCB_UART_Enable(scb_4_HW);

}

void uart_task(void *pvParameters) {

/* To avoid compiler warnings */
(void)pvParameters;
uint32_t ulNotificationValue;

while (true) {
/* Start the receiving from UART. */
UART_receive();
/* Wait to be notified that the receive is complete. Note
the first parameter is pdTRUE, which has the effect of clearing
the task's notification value back to 0, making the notification
value act like a binary (rather than a counting) semaphore. */
ulNotificationValue = ulTaskNotifyTake(pdTRUE, portMAX_DELAY );

if( ulNotificationValue == 1 )
{
/* Blocking wait until buffer is full */
// in this example, it will never handle because the UART interrupt fires exactly when the buffer is full
while (0UL != (CY_SCB_UART_RECEIVE_ACTIVE & Cy_SCB_UART_GetReceiveStatus(scb_4_HW, &uartContext))) {}
/* Handle received data */
char tempBuffer[UART_BUFFER_SIZE];

sprintf(tempBuffer, rxBuffer);
}
}
}

// UART activate a receive with interrupt. Wait for ever for UART_BUFFER_SIZE bytes
void UART_receive() {
/* At this point xTaskToNotify should be NULL as no receive
is in progress. A mutex can be used to guard access to the
peripheral if necessary. */
configASSERT( xTaskToNotify == NULL );

/* Store the handle of the calling task. */
xTaskToNotify = xTaskGetCurrentTaskHandle();

/* Start receive operation (do not check status) */
(void) Cy_SCB_UART_Receive(scb_4_HW, rxBuffer, sizeof(rxBuffer), &uartContext);
}

// UART interrupt handler
void UART_Isr() {
Cy_SCB_UART_Interrupt(scb_4_HW, &uartContext);

BaseType_t xHigherPriorityTaskWoken = pdFALSE;

configASSERT( xTaskToNotify != NULL );

/* Notify the task that the receive is complete. */
vTaskNotifyGiveFromISR( xTaskToNotify, &xHigherPriorityTaskWoken );
/* There are no receive in progress, so no tasks to notify. */
xTaskToNotify = NULL;

/* If xHigherPriorityTaskWoken is now set to pdTRUE then a
context switch should be performed to ensure the interrupt
returns directly to the highest priority task. The macro used
for this purpose is dependent on the port in use and may be
called portEND_SWITCHING_ISR(). */
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}

0 Likes

The pins 8.0 and 8.1 can be assigned to the UART of scb4. Some modifications must be done on the breakout to disconnect respective CAPSENSE hardware. See KIT Documentation page 48.

0 Likes