PSoC™ 4 Forum Discussions
I'm looking for a way to read piezo vibrations in a constant stream, both positive and negative AC voltage signals. How would I set that up with the ADC to get the correct readings?
Show LessI made a very simple test jig , where the system clock is set to 48MHz, no dividers. I am simply toggling a pin.
int main()
{
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
/* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */
for(;;)
{
SCLK_Write(0x01);
SCLK_Write(0x00);
/* Place your application code here. */
}
}
but I am not seeing the pin toggle at nearly the rate I would expect given the system clock speed. Frequency of the output is 350kHz, so it is 48MHz/350kHz = 137 off from 48MHz. I have a hard time believing that there are so many cycles per instruction. Rather, I am thinking something is not configured quite right in my project. What could it be?
Also, why is there a question mark under Desired for Sysclk?
Show LessI am trying to read values from a BLE server on one module using a Pioneer Kit as the Client so that I can hook up the Bridge Control Panel to the client via USB->I2C and plot the results.
I've taken the 100 Projects In 100 Days, Days #035 and #036 as my template, but I want to convert notifications to reads and as the service on the server module is a custom service it has a 128 bit UUID. I trigger a read using the following function:
void ReadPadsValues(void) {
CYBLE_API_RESULT_T api_result;
CYBLE_GATTC_READ_BY_TYPE_REQ_T *cyBle_readreq;
cyBle_readreq->range = attrHandleRange;
cyBle_readreq->uuid = PadsCharUuid;
cyBle_readreq->uuidFormat = CYBLE_GATT_128_BIT_UUID_FORMAT;
api_result = CyBle_GattcReadUsingCharacteristicUuid(cyBle_connHandle, cyBle_readreq);
}
I have tried to initialise PadsCharUuid
with my service UUID as a CYBLE_UUID_T
type, like this:
CYBLE_UUID_T PadsCharUuid = {.uuid128 = {0x00u, 0x31u, 0x01u, 0x9Bu, 0x5Fu, 0x80u, 0x00u, 0x00u, \
0x80u, 0x00u, 0x10u, 0x00u, 0x01u, 0xCBu, 0x03u, 0x00u}};
But in the automatically generated file BLE_StackGatt.h, GATT_SUPPORT_128_BIT_UUID
is not defined, so the type CYBLE_UUID_T
does not include the uuid128 portion of the union. So I get a warning when trying to initialise PadsCharUuid
.
Is there a way in the tools to cause GATT_SUPPORT_128_BIT_UUID
to be defined? Or is there a specific reason why it isn't, and am I going about it the wrong way.
Many thanks in advance.
Zigs
Show Lesswhat is MPS and what is the need of it L2CAP credit based channel..?
What is the difference between MPS and MTU..?
I didn't understand the meaning from spec..?can u explain in practical scenario...?
Thanks and Regards,
Sridhar Naidu.
Show LessHi,
- When compiled and configured AN91162 e'thing worked.
- Instead of PrISM, want to have my own functionality. That functionality being timing critical has been written in verilog and a custom component is created.
PLD Packing Summary
------------------------------------------------------------
Resource Type : Used : Free : Max : % Used
====================================================
PLDs : 4 : 4 : 8 : 50.00%
- Later, I combined 2 cases mentioned above.
- So that I can control my custom component through same scheme instead of PrISM and the LEDs.
- But now, the PLD resource utilization has jumped to 225%
- Error: mpr.M0014: Resource limit: Maximum number of Pre-configured Blocks exceeded (max=4, needed=9). (App=cydsfit)
We like to implement SPI in slave mode , but our SPI communication is point to point and we not want uses a microcontroller pin to enable/disable pin,. How we can force by software configuration (or Creator) SPI slave always receives data?
thanks
microcontroller : CYBL10573-56LQXI
Show LessHello,
I'm working on PSoC 4BLE . I created a program using emFile(SPI) component . I created a folder & file & able to store the data. I want to do some time slotting there. I want that file will automatically create in every 1 hour & directory will automatically create in every day so i'll have 24 files in a day & they'll store in a directory. Directory will have date stamping & file will have time stamping so the folder for today have date as folder name like - 02/20/2016 & it has 24 files according to time basis . Can anyone suggest me to do with emFile component.
/* ========================================
*
* Copyright YOUR COMPANY, THE YEAR
* All Rights Reserved
* UNPUBLISHED, LICENSED SOFTWARE.
*
* CONFIDENTIAL AND PROPRIETARY INFORMATION
* WHICH IS THE PROPERTY OF your company.
*
* ========================================
*/
#include <project.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <math.h>
#include "adc.h"
#include "rtc.c"
#include <FS.h>
#include <time.h>
#include <locale.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <Global.h>
uint32 dataReady ;
int16 result[ADC_SAR_SEQ_TOTAL_CHANNELS_NUM];
uint32 timer_delay ;
int length;
int main()
{
int16 res = 0;
int32 temperature;
//char uartLine[250];
int16 ADCCountsCorrected;
char tempBuffer[16u];
char dateBuffer[16u];
char mixBuffer[32u];
// int i=1;
//char* extension = ".txt";
//char file_name[30] = "File";
// char sdFile[strlen(file_name)+strlen(extension)+1];
char sdFile[30] = "File.txt";
char str_date[30];
char time_str[30];
char dir_name[30];
//char temp[30]="\\";
//char temp1[30]="\\";
uint32 time1;
uint32 date;
char sdVolName[32]; /* Buffer that will hold SD card Volume name */
FS_FILE * pFile;
//time_t current_time;
// struct tm *tm;
//current_time = time( NULL);
//tm = localtime(¤t_time);
U32 TimeStamp;
CyGlobalIntEnable;
/* Initialize the UART */
UART_Start();
UART_UartPutCRLF(32u);
UART_UartPutCRLF(32u);
UART_UartPutString("Starting readings...");
UART_UartPutCRLF(32u);
PWM_Start();
PWM_TriggerCommand(PWM_MASK, PWM_CMD_START);
/* Init and start sequencing SAR ADC */
ADC_SAR_SEQ_Start();
ADC_SAR_SEQ_StartConvert();
/* Enable interrupt and set interrupt handler to local routine */
ADC_SAR_SEQ_IRQ_StartEx(ADC_SAR_SEQ_ISR_LOC);
/* Init interrupt from timer to measure the temperature rarely */
ISR_TIMER_StartEx(ISR_TIMER_LOC);
/* Enable WCO */
CySysClkWcoStart();
{
/* Alarm structure initialization */
alarmTimeDate.time = ALARM_TIME_HR_MIN_SEC;
alarmTimeDate.date = ALARM_DATE_MONTH_DAY_YEAR;
/* Prepare COUNTER0 to use it by CySysTimerDelay function in
* "INTERRUPT" mode: disable "clear on match" functionality, configure
* COUNTER0 to generate interrupts on match.
*/
CySysWdtSetClearOnMatch(CY_SYS_WDT_COUNTER0, 0u);
CySysWdtSetMode(CY_SYS_WDT_COUNTER0, CY_SYS_WDT_MODE_INT);
/* Enable WDT COUNTER0 */
CySysWdtEnable(CY_SYS_WDT_COUNTER0_MASK);
/* Disable servicing interrupts from WDT_COUNTER0 to prevent
trigger callback before the CySysTimerDelay() function. */
CySysWdtDisableCounterIsr(CY_SYS_WDT_COUNTER0);
/* Register EnableRtcOperation() by the COUNTER0. */
CySysWdtSetInterruptCallback(CY_SYS_WDT_COUNTER0, EnableRtcOperation);
/* Initiate run the EnableRtcOperation() callback in WCO_STARTUP_DELAY_CYCLES interval. */
CySysTimerDelay(CY_SYS_WDT_COUNTER0, CY_SYS_TIMER_INTERRUPT, WCO_STARTUP_DELAY_CYCLES);
/* Start RTC component */
RTC_Start();
/* Set Date and Time */
RTC_SetDateAndTime(TIME_HR_MIN_SEC,DATE_MONTH_DAY_YEAR);
/* Ignore second mask to call alarm */
RTC_SetAlarmMask((uint32)~RTC_ALARM_SEC_MASK);
/* Set Alarm Date and Time */
RTC_SetAlarmDateAndTime(&alarmTimeDate);
/* Set RTC time update period */
RTC_SetPeriod(1u, TICK_EACH_1_HZ);
/* Set function AlarmIsrHandler to be called when alarm triggers */
RTC_SetAlarmHandler(AlarmIsrHandler);
/* Initialize file system */
FS_Init();
/* Get volume name of SD card #0 */
if(0 != FS_GetVolumeName(0u, &sdVolName[0], 9u))
{
/* Getting volume name succeeded */
UART_UartPutString(" mixBuffer ");
UART_UartPutString(sdVolName);
}
else
{
/* Operation Failed - indicate this */
UART_UartPutString(" Failed to get mixBuffer");
}
/* This will create directory "Dir" on SD card */
if(0 == FS_MkDir("DIR"))
{
/* Display successful directory creation message */
UART_UartPutString(" Directory created");
}
else
{
/* Display failure message */
UART_UartPutString(" Failed to create directory");
}
while(1)
{
/* Get Date and Time from RTC */
time1 = RTC_GetTime();
date = RTC_GetDate();
length = sprintf(mixBuffer, "\r\n%02lu:%02lu:%02lu ,%02lu/%02lu/%02lu,Temperature Value: %dC,ADC Voltage Measurement: %dmV ",RTC_GetHours(time1), RTC_GetMinutes(time1), RTC_GetSecond(time1),RTC_GetMonth(date), RTC_GetDay(date), RTC_GetYear(date),(int16) temperature,(uint16) res);
UART_UartPutString(mixBuffer);
/* When conversion of sequencing channels has completed */
if((dataReady & ADC_SAR_SEQ_EOS_MASK) != 0u)
{
/* Get voltage, measured by ADC */
dataReady &= ~ADC_SAR_SEQ_EOS_MASK;
res = ADC_SAR_SEQ_CountsTo_mVolts(CH0_N, result[CH0_N]);
}
/* When conversion of the injection channel has completed */
if((dataReady & ADC_SAR_SEQ_INJ_EOC_MASK) != 0u)
{
dataReady &= ~ADC_SAR_SEQ_INJ_EOC_MASK;
/******************************************************************************
* Adjust data from ADC with respect to Vref value.
* This adjustment is to be done if Vref is set to any other than
* internal 1.024V.
* For more detailed description see Functional Description section
* of DieTemp P4 datasheet.
*******************************************************************************/
ADCCountsCorrected = result[TEMP_CH]*((int16)((float)ADC_VREF_VALUE_V/1.024));
temperature = DieTemp_CountsTo_Celsius(ADCCountsCorrected);
if (alarmFlag == 1u)
{
UART_UartPutString(" Alarm ");
alarmFlag = 0u;
}
else
{
UART_UartPutString(" No alarm");
}
//UART_UartPutString("\r")
}
//sprintf(str_date, "%02lu-%02lu-%02lu", RTC_GetMonth(date),RTC_GetDay(date),RTC_GetYear(date));
//strftime(str_date, sizeof(str_date), "%m %d %Y", tm);
//sprintf(file_name, "%s",myint);
// snprintf( sdFile, sizeof( sdFile ), "%s%c%s", file_name,i, extension );
// UART_UartPutString(str_date);
// i++;
// strcpy(file_name,"%02lu-%02lu-%02lu");
//strcpy(sdFile,date_str);
pFile = FS_FOpen(sdFile, "a");
/* Check if file was created */
if(pFile)
{
/* Indicate successful file creation message */
UART_UartPutString("File ");
UART_UartPutString(sdFile);
UART_UartPutString(" was opened");
if(0 != FS_FWrite(mixBuffer,1,length , pFile))
{
/* Inditate that data was written to a file */
UART_UartPutString("mixBuffer ");
UART_UartPutString(sdFile);
UART_UartPutString(" written to file");
}
else
{
UART_UartPutString(" Failed to write data to file");
}
if(0 == FS_FClose(pFile))
{
UART_UartPutString(" File was closed");
}
else
{
UART_UartPutString(" Failed to close file");
}
}
else
{
UART_UartPutString(" Failed to create file");
}
if(0 == FS_Move(sdFile, "\\DIR\\Time.txt"))
{
UART_UartPutString(" File was moved to DIR");
}
else
{
UART_UartPutString(" Failed to move file");
}
sprintf(dir_name, "Date-%02lu-%02lu-%02lu", RTC_GetMonth(date),RTC_GetDay(date),RTC_GetYear(date));
// strcat( temp, dir_name);
//strcat(temp,temp1);
//UART_UartPutString(temp);
if(0 == FS_Rename("\\Dir", dir_name))
{
UART_UartPutString(" Rename Successful");
}
else
{
UART_UartPutString(" Rename Unsuccessful");
}
UART_UartPutString(" mixBuffer completed");
}
}
return length;
}
/* [] END OF FILE */
Thanks,
Show LessI've been trying to wrap my head around how the different roles interact so here goes my interpretation. The GAP roles manage the connection. The central role typically manages connections to one to many peripheral roles.
The client role initiates data transfer from/to the servers. Typically, the client and server will be on different machines so a read or write of the data will result in a transfer over the radio with the application level protocol defined by GATT profiles. The servers store/retrieve data based on the Gatt profiles. The GUI implies that one physical machine can play the role of client and server. In this case, the transfer would not occur over the radio.
I kept looking for APIs that would transfer data over the physical connection. But it's the read/write by the client that causes the transfer - an abstraction that has not been clear to me.
Is this a reasonable interpretation?
Show LessHello
Actually I send 12 byte data in case of notification then device disconnect , if i send 9 byte data then it easily transfer, my mtu is 23 byte , i think 12 bye easily transfer in single packet of notification
what max. data length in 23 byte mtu i can send , or I miss any step.
Thanks in advance
Show LessHallo everyone,
I want to test a Cypress-Controller CY8CKIT-042-BLE with Cypress BLE Dongle using CySmart 1.1
But the device can not be connected, does anyone know?
I attached the sreenshot.
Thanks
Show Less