PSoC™ 6 Forum Discussions
I'd like to sneak in a temperature measurement from time to time, while the ADC is usually busy scanning 4 differential channels using SARSEQ. From the PSoC63 register TRM I gathered that exactly this use case is suitable for the ADC's injection channel. However, the architecture TRM is pretty silent about it (I have document 002-18176 Rev. *J).
Also there are some screenshots of example projects that show a die temperature sensor component in the schematic. I can't find it in PSoC Creator's component catalog, but the resource meter shows it as unused - so it's there in Creator's internals in some way. How do I add the temperature measurement to the schematic (do I need it there in the first place)?
Show LessHi again.
I have been testing the connection between both the Dongle and the Psoc 6 Kit. It seems I am only limited to send 20 bytes per notification packet. I am guessing this is an MTU limitation on the dongle side. How shall I raise the Client MTU to the maximum? Do I need to Exchange MTU? or can I adjust it directly via code?
This is the part in the C# code where I receive the notification packet and check its byte contents
/ Setup the characteristic changed handler
GATTClientEventCallback.CharacteristicChangedHandler = (NotifyEventParam) =>
{
//All Notification Values are retrieved from here
if (NotificationText.InvokeRequired)
{
Invoke((MethodInvoker) (() =>
{
string[] notificationArray = new string[20]; //<===== 20 bytes per notification packet
for (int i = 0; i < notificationArray.Length; i++)
{
notificationArray = NotifyEventParam.Value.ToString("X");
}
NotificationText.Text = NotifyEventParam.Value[19].ToString("X") + NotifyEventParam.Value[0].ToString("X");
//var dateTime = DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss",
// CultureInfo.InvariantCulture);
// notificationArray[0] = DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss",
// CultureInfo.InvariantCulture);
//Dump Data to file
File.AppendAllLines(path + fileName, notificationArray, Encoding.UTF8);
}));
}
else
{
//NotificationText.Text = NotifyEventParam.Value[1].ToString() + NotifyEventParam.Value[0].ToString();
}
};
On the C code on the kit
I define the size here
#define TICK_ARRAY_SIZE (20)
Fill dummy data here, then call updateTickValue function
for (int i = 0; i < TICK_ARRAY_SIZE ; i++)
{
timerTick += 1;
}
updateTickValue();
Then Send the notification here:
void updateTickValue()
{
cy_stc_ble_gatt_handle_value_pair_t handleValuePair;
handleValuePair.attrHandle = CY_BLE_LEDSERV_LEDPWM_CHAR_HANDLE;
handleValuePair.value.val = timerTick;
handleValuePair.value.len = TICK_ARRAY_SIZE ;
Cy_BLE_GATTS_WriteAttributeValueLocal(&handleValuePair);
if (notify == 1)
{
Cy_BLE_GATTS_SendNotification(&cy_ble_connHandle[0], &handleValuePair);
printf("Notification Tick Value Sent: %d - %d\r\n", timerTick[TICK_ARRAY_SIZE - 1], timerTick[0]);
}
}
1: I need help to exchange MTU with the kit on C# Application to negotiate for the maximum MTU possible. MTU exchange is already present on the kit. I checked it with CySmart App on PC and it is able to negotiate on 512 bytes MTU. So how do I use CyGattExchangeMtuInfo and CyGattExchangeMtuResult to exchange and display the exchange results?
2. Setting "Clock" at high speeds like 400 KHz for the counter timer freezes the notifications after a while, and the kit needs to be restarted again. Why is this happening?
3. Another side issue, but it is not important at the meantime for while, the GUI freezes when I disable the notifications. Is it something related to threading?
Show LessHello,
using PSoC Creator 4.3 with PDL v3 = 3.1.2 and PDL v2 = 2.1.0. The BLE Device is configured as Peripheral the connection settings are the following:
/* 8 x 1.25 = 10 ms */
#define MINIMUM_CONNECTION_INTERVAL (8u)
/* 8 x 1.25 = 10 ms */
#define MAXIMUM_CONNECTION_INTERVAL (8u)
/* 125 connection interval skips */
#define SLAVE_LATENCY 12
/* Supervision timeout of 3 second */
#define SUPERVISION_TIMEOUT (300u)
I use an BLE-Dongle as Central to activate Notifications. If they activated the Peripheral sends Notifications via BLE and than enter DeepSleep Mode. The WatchDogTimer is used to wakeup the System every 2 s. I recognized with an Poweranalyzer that the Powerconsumption is sometimes higher than I expected. It seems like the BLE device is running faulty in the background.
The sequence is:
trigger sensor measurement
enter DeepSleep
WatchDogTimer interrupt // after 25ms
read out sensor
send Notification
enter DeepSleep
WatchDogTimer interrupt // after 2 s
Bad:
Good:
Can someone explain what going with the BLE device? Why sometimes it work and why not?
regards,
Alex
Show LessI Have a question regarding the PSOC6 as central mode
What I want is to read the nerby devices but I can't find an example that works on psoc 6
I tried with 2 functions
Cy_BLE_GAPC_StartScan
and
Cy_BLE_GAPC_StartDiscovery
which one do I need to use?
I can't even trigger none of this events:
CY_BLE_EVT_GAPC_SCAN_PROGRESS_RESULT:
CY_BLE_EVT_GAPC_SCAN_START_STOP:
at first I thougth that StarScan trigger this two events
but reading Cypress PSoC 6 Bluetooth Low Energy Middleware Library 3.40
it says that the StartDiscovery function is the one that triggers this
so I'm not so sure right now which one is
I have no problem when working on perpheral and there are plenty of examples for this but for central I'm having a hard time to understand it
the device I'm using is CYBLE-416045-02 on a custom pcb that I design
Show LessI have a simple program for reading the JEDEC information from a serial flash chip using the low-level API.
static void SPI_FlashWriteByte(uint8_t byte)
{
SPI_ClearRxFifo();
SPI_Write(byte);
while (SPI_GetNumInRxFifo() == 0);
SPI_ClearRxFifo();
}
static uint8_t SPI_FlashReadByte()
{
SPI_ClearRxFifo();
SPI_Write(0xFF);
while (SPI_GetNumInRxFifo() == 0);
return SPI_Read();
}
static void SPI_FlashReadJEDEC_Info(uint8_t* mfgID, uint8_t* memoryType, uint8_t* capacityID)
{
CS_FlashEnable();
SPI_FlashWriteByte(0x9F);
*mfgID = SPI_FlashReadByte();
*memoryType = SPI_FlashReadByte();
*capacityID = SPI_FlashReadByte();
CS_FlashDisable();
}
int main(void)
{
__enable_irq(); /* Enable global interrupts. */
Cy_SCB_SPI_Init(SPI_HW, &SPI_config, NULL);
Cy_SCB_SPI_Enable(SPI_HW);
Trace_Init();
Trace_Log("\033[2J\033[H"); // Clear screen
Trace_Log("SPI Test\r\n");
for(;;)
{
uint8_t mfgID, memoryType, capacityID;
SPI_FlashReadJEDEC_Info(&mfgID, &memoryType, &capacityID);
Trace_Info("MfgID: 0x%02X, memoryType: 0x%02X, capacityID: 0x%02X", mfgID, memoryType, capacityID);
CyDelay(100);
}
}
Which produces the following signals.
D0 = chip select
D1 = SCLK
D2 = MOSI
D3 = MISO (the decoded data at the top is from MISO)
The problem is that each SPI_FlashReadByte() call returns the value that was in the FIFO from the SPI_FlashWriteByte() call.
I've tried using the high-level API with the same results.
Show LessI need to be absolutely certain of the following: My hardware engineer asked me to verify:
P10_0 can be configured A to D
P11_2 thru P11_6 can be configured to SDIO bus on MCU
P12_0 thru P12_3 can be configured to SDIO bus on MCU
P13_0 thru P13_2 can be configured to SPI bus on MCU
P4_0 thru P4_1 can be configured to I2C on MCU
I cannot find the SDIO in reference manual, datasheet, and trouble understanding 002-18449_002-18449_Alternate_Functions.xlsx and 002-23185-CY8C62x8_CY8C62xA_Pin_Functions_1_1.xlsx
Having trouble making certain without a doubt. Please direct me to documentation that will satisfy and prove to me that the above will work for his design.
Thank you.
William
Show LessI'm looking for ways to ease the chip from some combinatorial logic. I have 4 instances of a component that has a 4-input OR gate, and I'm tempted to remove that OR gate by moving it into a datapath. I'd use parallel in, and use the all-zero detector (inverted) to see if any bit is set - if that is feasible at all. Would that use less PLD resources than a 4-input OR gate? the number of signals (4 in, 1 out) is the same, but does it "free the way" for other parts of a larger design?
Also, could this be combined with a memory-to-hardware latch (D register to accumulator to parallel out)?
Show LessHello,
I am reading AN22875 ”DMA on PSoC 6 MCU”. So, I have a question about "Elements of a Transfer" in section 10.1 and Table 1.
Although it is written as 2 cycles in the explanation, it is 3 cycles in the table. Is this right?
The explanation:
A transfer can be split into multiple operations as shown in Table 1 with the corresponding cycles needed for their execution. Each transaction is initiated by a trigger, which goes through trigger synchronization circuit and takes up two cycles. These two cycles will be consumed whenever there is a trigger event being used.
Table 1:
Operation | Cycles (Slow Clock Cycles) |
---|---|
Trigger Synchronization and Priority decoding | 3 |
Start state machine and load channel config | 3 |
Load descriptors | 4 for single transfer 5 for 1D transfer 6 for 2D transfer |
Load next pointer 1 | 1 |
Moving data from source to destination | 3 |
Thanks,
Kenshow
Show LessHi
Is there a specific programming sequence for writing firware to CYBLE-416045-02 to program bluetooth? If so, where can I find it? Can it be programmed over the SWD interface in PSoC Programmer or Creator?
Thank you
Show LessI'm working with Mbed Studio 6.1 and CY8CPROTO-062-4343W on a project with MBed OS 6.2
Following the sample code of the HAL documentation I created the following functions:
#include "cyhal.h"
#include "displayThread.h"
bool timer_interrupt_flag = false;
cyhal_timer_t timer_obj;
static void isr_timer(void *callback_arg, cyhal_timer_event_t event)
{
(void) callback_arg;
(void) event;
/* Set the interrupt flag and process it from the application */
timer_interrupt_flag = true;
displaySendUpdateTime();
}
cy_rslt_t initPeriodicTimer()
{
cy_rslt_t rslt;
const cyhal_timer_cfg_t timer_cfg =
{
.compare_value = 0, /* Timer compare value, not used */
.period = 999, /* Defines the timer period */
.direction = CYHAL_TIMER_DIR_UP, /* Timer counts up */
.is_compare = false, /* Don't use compare mode */
.is_continuous = true, /* Run the timer indefinitely */
.value = 0 /* Initial value of counter */
};
/* Initialize the timer object. Does not use pin output ('pin' is NC) and
* does not use a pre-configured clock source ('clk' is NULL). */
rslt = cyhal_timer_init(&timer_obj, NC, NULL);
if ( rslt == CY_RSLT_SUCCESS)
{
/* Apply timer configuration such as period, count direction, run mode, etc. */
rslt = cyhal_timer_configure(&timer_obj, &timer_cfg);
if ( rslt == CY_RSLT_SUCCESS)
{
rslt = cyhal_timer_set_frequency(&timer_obj, 1000);
/* Start the timer with the configured settings */
if ( rslt == CY_RSLT_SUCCESS)
{
/* Assign the ISR to execute on timer interrupt */
cyhal_timer_register_callback(&timer_obj, isr_timer, NULL);
/* Set the event on which timer interrupt occurs and enable it */
cyhal_timer_enable_event(&timer_obj, CYHAL_TIMER_IRQ_TERMINAL_COUNT, 3, true);
rslt = cyhal_timer_start(&timer_obj);
}
}
}
return rslt;
}
When compiling the project I get the following 2 errors (timerISR.cpp is my function above):
[Error] @0,0: L6218E: Undefined symbol cyhal_tcpwm_enable_event(TCPWM_V1_Type*, cyhal_resource_inst_t*, unsigned, unsigned char, bool) (referred from BUILD/CY8CPROTO_062_4343W/ARMC6/timerISR.o).
[Error] @0,0: L6218E: Undefined symbol cyhal_tcpwm_register_callback(cyhal_resource_inst_t*, void(*)(), void*) (referred from BUILD/CY8CPROTO_062_4343W/ARMC6/timerISR.o).
but I can't find the ultimate ..internal() targets anywhere...