PSoC™ 6 Forum Discussions
So I know how to sent a int over BLE, but now I want to sent a string but I can't seem to find out how.
This is how I sent a int, that i can read from my app:
for(;;)
{
/* https://www.youtube.com/watch?v=Aeip0hkc4YE*/
cy_stc_ble_gatt_handle_value_pair_t serviceHandle;
cy_stc_ble_gatt_value_t serviceData;
serviceData.val = (uint8*)data;
serviceData.len = 1;
serviceHandle.attrHandle = CY_BLE_CUSTOM_SERVICE_DEVICE_OUTBOUND_CHAR_HANDLE;
serviceHandle.value = serviceData;
Cy_BLE_GATTS_WriteAttributeValueLocal(&serviceHandle);
data[0]++;
CyDelay(1000);
}
This counts up every second and I can read it.
but if I want to sent a string how can I do that?? I tried somthing like this, but i only read the start letter 'M':
ValStr = "Mads Sander Hoegstrup";
serviceData.val = (uint8*) ValStr;
serviceData.len = 1;
serviceHandle.attrHandle = CY_BLE_CUSTOM_SERVICE_DEVICE_OUTBOUND_2_CHAR_HANDLE;
serviceHandle.value = serviceData;
Cy_BLE_GATTS_WriteAttributeValueLocal(&serviceHandle);
Show LessHello,
I am working on a design that requires additional external RAM in excess of what is available (288 KB) on the CY8C6347FMI-BLD53T.
I am particularly interested in utilizing the octal SPI interface on the PSoC 6. Due to current part stocking issues, I was unable to find an SRAM that runs at 3.3V (the PSoC 6 is configured for 3.3V in my design). The chip I finally decided to use runs at 1.8V and is the 64Mb S27KS0643GABHV020.
However, it says on the data sheet for the Pseudo SRAM, that the differential clock is optional and the CK# need not be used. It does clearly say that the 3.0V chip in the same family, uses a single-ended clock. Since the PSoC6 generates a single-ended clock output on its SMIF interface that supports octal SPI, I was not sure if I really needed a single-ended to differential converter for the same. My initial research led to utilizing an LTC6403-1 fully differential driver on the board. Since I have design constraints, and the system on board runs at 3.3V, I needed to add a 1.8v regulator in the mix as well. But that’s pretty much the extent to which I can add components to my system (I have level shifters for the 3.3v to 1.8v conversion on the data lines and the additional CS, RWDS lines).
So I have few questions:
1. Does the external Pseudo SRAM (S27KS0643GABHV020) I selected really need a differential clock? Can I make do with a single ended clock input from the PSoC 6?
2. What part is recommended for level shifting a clock output from 3.3V to 1.8V?
3. If it is mandatory to have a differential clock, what part is recommended for single ended to differential clock conversion in my current setup?
Thanks in advance.
Show LessI think that I have pretty compelling evidence that Cy_SCB_SPI_Transfer() does not work correctly when oversampling is 4 and relatively long spi exchanges are requested.
Basically, if I try one long exchange, Cy_SCB_SPI_Transfer() fails to complete correctly. If I chop up the long exchange into a sequence of smaller exchanges with each the length of each exchange being shorter than the Tx/Rx fifo (128 bytes), the system does not lock up.
Of course, this creates other problems because the enable signal is cleared after each shorter block and the target device can't handle that. I worked around that by using another I/O pin as the enable and manually controlling it.
Anyhow, if anyone has any ideas as to how to fix Cy_SCB_SPI_Transfer() I'd be glad to hear it. Otherwise, what is the proper/best way to bring this issue to the attention of the Cypress damage control team?
Thanks,
Ed H.
Show LessHello,
So I've setup a small BLE program, with a read and write. I can find it with the cypress app "CySmart" on my Android phone. Now my question is, how can I make this connection with a selfmade android app? I need to be able to, lets say turn on a led, and maybe recive somthing from the PSoC to display on the app to start with, but i cant find any good guide on how to get startet. I've made some android apps, but never used BLE.
Here is my PSoC creator project: Project File
For the android studio app, I've startet a project, but I think i need some help: Android studio project
Regards Mads
Show LessThis is a long shot, but I am at my wit's end with this bug.
I am using a simple task to share the SPI bus in my system. Other tasks place a request in the task's input queue. The task wake up, does the SPI exchange over the bus, and then sends the response back to the calling task's response queue.
This has been working fine for months using an SPI oversampling of 16. Unfortunately, this relatively slow SPI speed makes the LCD look slow and clunky (and the client really is dissatisfied). Now here is the weird part. I can reduce the oversampling to 8 and the system still works fine. But if I go down to an oversampling of 4, the task locks up.
Now here is was really has me puzzled. The task will work fine for several hundred exchanges with an oversample of 4, but then locks up. Now, given that the SPI bus speed was faster, I expected the problem to have something to do with the Cy_SCB_SPI_Transfer. But... that doesn't seem to be the case. When the task locks up the inUse flag is false (its only purpose is to tell me if the CY_SCB_SPI_Transfer has locked up). Breakpoint on the error cases in the call back routine are never hit. exchangeOK is always true. So it sure seems like CY_SCB_SPI_Transfer isn't bothered by the higher bus speed. But by careful placement of breakpoints, I am fairly certain that the problem is that the when the task is blocked it suddenly stops waking up when a new request is put in the input queue. And I have never been able to pin this wake-up failure on anything in particular.
With a faster bus speed the SPI task should be able to service requests faster than before, so that rules out things like the queues filling up (unlikely in any case).
So... Has anybody else seen problem like this? Or can anybody spot a flaw in the code? (The initialization code that creates the queue and semaphore is not shown).
Thanks,
Ed H.
/**************************************************************************//**
@brief Callback function registered with the interrupt service routine (ISR)
for the SPI channel. Used by the ISR to pass event notifications back
to this task.
@param theEvent - see #defines in cy_scb_i2c.h
******************************************************************************/
static void spiCallback( uint32_t theEvent )
{
(void)theEvent;
higherPriorityTaskWoken = false;
switch( theEvent )
{
case CY_SCB_SPI_TRANSFER_IN_FIFO_EVENT :
// All bytes loaded into the TX FIFO. Nice to know, but we really just
// want to know when it is finished.
break;
case CY_SCB_SPI_TRANSFER_CMPLT_EVENT:
// Exchange operation is complete. Pass the news on to the task.
exchangeOk = true;
xSemaphoreGiveFromISR( spiSemaphore, &higherPriorityTaskWoken);
break;
case CY_SCB_SPI_TRANSFER_ERR_EVENT:
// Bad news.
exchangeOk =false;
xSemaphoreGiveFromISR( spiSemaphore, &higherPriorityTaskWoken);
break;
default:
// Should never arrive here.
exchangeOk = false;
xSemaphoreGiveFromISR( spiSemaphore, &higherPriorityTaskWoken);
break;
}
portYIELD_FROM_ISR( higherPriorityTaskWoken );
}
/**************************************************************************//**
@brief Process any requests for a write/read/exchange of data on the SPI
channel that have been placed in the SPI request queue. Once the exchange
has completed, send the final status of the exchange back to the response
queue that was included as part of the request.
@param args - not used but mandated by FreeRTOS's prototype for a task.
******************************************************************************/
void SpiMasterTask( void* args)
{
SpiRequest activeRequest;
bool inUse;
UNUSED(args);
spiSemaphore = xSemaphoreCreateBinary();
// Use the auto-generated code to initialize the SPI Channel
SpiMaster_Start();
// Connect the auto-generated interrupt service routine for the
// SPI channel to this task.
Cy_SCB_SPI_RegisterCallback( SpiMaster_HW, spiCallback, &SpiMaster_context );
spiMasterTaskUpAndRunning = true;
while( true )
{
xQueueReceive( spiRequestQueue, &activeRequest, portMAX_DELAY );
inUse = true;
// Assume we are going to fail (comm error or timeout).
exchangeOk = false;
// Select either the LCD, flash memory or the motor controller IC.
Cy_SCB_SPI_SetActiveSlaveSelect( SpiMaster_HW,
(cy_en_scb_spi_slave_select_t)(activeRequest.slave));
// Exchange the data with the selected target.
Cy_SCB_SPI_Transfer( SpiMaster_HW, activeRequest.writeBytes, activeRequest.readBytes,
activeRequest.bytesToExchange, &SpiMaster_context);
// Wait for the exchange to complete.
xSemaphoreTake( spiSemaphore, portMAX_DELAY);
xQueueSendToBack( activeRequest.answerBackQueue, (void*)&exchangeOk,
portMAX_DELAY);
inUse = false;
}
}
Hello, I've been trying to run unit tests for an embedded PSOC device, and i've been following this guide:
https://dmitryfrank.com/articles/unit_testing_embedded_c_applications
When I compile, it says I am missing cy_device_common.h, which I presume is the equivalent of xc.h in the
guide. If I create an empty dummy, the missing file error goes away but is replaced by a lot of other errors, culminating
in a ShellExecutionException and Ceedling failed error.
This is probably because the dummy is empty and I do not know what is needed in it for it to work. Does anyone know
what functions/defines need to be replaced (i.e. I know __STATIC_INLINE, __NO_RETURN, SFLASH need to be defined),
or know where I can find cy_device_common.h? Thank you.
Show LessI'd like to try PI DYN in a datapath, but it's grayed out in the datapath configuration tool:
I understand that to actually use PI dynamically, I also have to set CFB EN for the given instruction in CFGRAM, because CFB EN and PI DYN are ANDed, and I'd have to switch PI SEL back to ACC:
But how do I set PI DYN?
Show LessHi,
Could anyone point me to an example showing PSoC6 with internet connectivity using a GSM modem on an UART port (e.g. SIMCom or Quectel modem)? I assume it should make use of FreeRTOS and LwIP Point-to-Point (PPP) stack. Thanks!
Best Regards,
Stan
Show LessI am using the DFU bootloader and bootloadable examples, both working.
now I want read write the Sflash how to do ...?
When i tried to do with the function
Cy_Flash_WriteRow((uint32_t)0x16000800,(uint32_t*)newData); device hangs up and never returns.
how to solve this..?
Show LessGreetings All!
The answer to this question may be painfully obvious, but I'm just not "seeing" it yet.
I'm using a PSOC6 (M4 core with floating point) to close a PID loop on a simple DC-DC boost converter (inner current loop only for now). I'm setting a desired current value (let's say 1 amp), and I'm measuring the actual current, and I pass the error through the PI loop (for now, my loop is just a PI loop - no derivative gain).
The PWM element I'm using to drive the switching transistor is:
50kHz
PWM counter is 16 bits
period = 1000 counts (so valid compare values are from 0 [0% duty] to 1000 [100% duty])
Center aligned
--> Once I have the output of the PI loop controller (in floating point), how do I scale this to a value of 0 to 1000 for the PWM generation?
Show Less