PSoC™ 4 Forum Discussions
Hi I need help with the following design.
I have tried to mash two sample projects together and i do not understand the code enough.
Hope someone can look and make sense of it.
Appreciate any help.
Show LessI'm trying to fit as much as I possibly can into a PSoC4 - I want 2 quadrature decoders, 6 pwm outputs, and 3 serial modules
By putting two of the serials in to SCBs and the 2 quadrature decoders + 2 PWMs into TCPWM blocks, it just leaves enough for the remaining serial and PWMs in UDBa
I can put in 1 x 8 bit double output PWM modules with no trouble, giving me a total of 4 pwm outputs. When I build, this reports enough resources remaining to add another PWM. However, when I try, it says "5 UDBs required" 😞
Can any one shed any light on this?
Show LessI will upload my project in the next post but it's giving me a problem in that code that works in main.c doesn't work in isr_1.c, specifically the code starting at line 198 in main.c
response = LIS3DH_GetAccAxesRaw(&data); // TM read and print Raw Accel data
if(response==1){
//print data values
sprintf(strMsg1, "Xx=%6d Yy=%6d Zz=%6d \r\n", (data.AXIS_X >> 6), (data.AXIS_Y >> 6), (data.AXIS_Z >> 6) );
SCB_1_UartPutString(strMsg1);
}
sprintf(strMsg1, "X=%6d Y=%6d Z=%6d \r\n", (rawAccel[0][0]), (rawAccel[1][0]), (rawAccel[2][0]));
Works with data read out like Xx= -12 Yy= 7 Zz= 244
but the same code at ine 185 in isr_1.c is supposed to populate the array variable rawAccel[0][0]..[2][0]
response = LIS3DH_GetAccAxesRaw(&data); // TM read and store Raw Accel data
if(response==1){
LED_2_Write(1);
rawAccel[0][0] = data.AXIS_X;
rawAccel[1][0] = data.AXIS_Y;
rawAccel[2][0] = data.AXIS_Z;
}
which is supposed to be printed out by line 204 (the last line in the code above) but it doesn't produce any data, the printed line is always all zeros. The raw accelerometer data is supposed to be 12 bits left justified stored in a int16. I've proved that, in the ISR code, I'm getting a 1 for the response because LED2 lights up. This may be the way I'm trying to share variables across all the files.
I'd appreciate any guidance you guys may have.
Show LessHello:
Does anyone know what the interrupt latency is for the PSoC 4? I am running a 4200 with an external 48MHz clock. When I trigger an interrupt with a timer compare, there is an 800ns delay before the ISR toggles an output line. I am using a register write, not one of the generated functions. My understanding was that latency for M0 was 16 cycles. If that was the case, the delay would only be about 350ns. Am I doing something wrong, or are interrupts slow on this MCU?
A search of the data sheet and technical reference manual did not reveal any answers.
Thanks,
Stephen
Show LessHi,
In latest datasheet version (L) there is a watermark saying "Not Recommended for New Designs"
I couldn't find any document neither about this issue nor about substitutes
Please advise,
Thanks
Show LessI'm not able to get the fixed stack OTA update code example to work on the PRoC BLE. I can get it to work on the PSoC BLE. When I try and do the OTA update on PRoC, it fails every time. What modifications do I need to make to the example code to get it to work on this kit? Thanks.
Show LessHello All
Im currently working on some code to read from TI's LDC1000, one issue with this sensor is the noise, so i require a moving average.
Now ive tried this a few ways and keep seeing the same issue. an array needs to be written to, read from and over written. now for some reason the values being written in aren't what get read out.
The array pointer, for some unknown reason counts from 0-99 (100 field array) correctly, then once it fills the first time it then starts going crazy.
09,19, 29,39,49,59,69,79,89,99,10,11,12.......99 i cant see how mathematically this is even possible?
then there's the values being called back from the array, given the values written in are +/-50 bits im getting random values over the whole 16bit resolution (65,535).
heres the function for reading the average:
uint16 getCurrentRollingAverage(uint16 newValue){
int arrayLength =100;
uint16 measurements[100];
int average = 0;
uint16 poppedValue = 0;
uint32 rollingTotal =0;
if(numAdded < arrayLength){
//rolling total calculation is a simple divide of the
//total until the array is full. No push/pop logic needed.
rollingTotal = rollingTotal + newValue;
average = rollingTotal / (numAdded + 1);
}
else{
//read the array value that we are about to overwrite, and subtract it from
//our rolling total so that the average works out correctly.
poppedValue = measurements[arrayPointer % arrayLength];
//rolling total now loses the old value we've popped, and gains the new value.
rollingTotal = rollingTotal + newValue - poppedValue;
//but we still divide by the arraylength + 1.
average = rollingTotal / (arrayLength + 1);
}
//store the new value for later. Store it in the position we've just pulled "poppedValue" from
//and we can now lose this poppedValue as we've used it already.
measurements[arrayPointer] = newValue;
//move the global array pointer forwards, or to the end of the array if <0.
arrayPointer = (arrayPointer+1) % arrayLength;
//we want to increment this until the array is full.
if(numAdded <= arrayLength){
numAdded++;
}
//give the new average.
return average;
}
Hi,
Sorry if I have posted in a wrong category of topic. I'm facing some issue when trying to perform OTA Upgrade after finishing the steps for "Adding an External Memory OTA Bootloader" section as described in the below attached document. I have done all the changes as specified in the document attached for the device "CYBC4247LQI-BL483".
Please let me know if I have to update anything else.
Thank You
Show LessHi,
I am trying to use this code for PSOC 4 BLE Pioneer kit and there are below errors coming up even after changing device in both bootloadable and bootloader project through device selector...
error 1: The selected device for the Bootloader and Bootloadable projects must match, but don't. Bootloader is targeting 'CY8C4245AXI-483' and Bootloadable is targeting 'CY8C4247LQI-BL483'.
error 2: CyDsFit aborted due to errors, please address all errors and rerun CyDsFit
Show LessHi All,
I bought the CY8CKIT-040 PSoC 4000 pioneer kit about a year ago and it worked great for a project i needed it for back then, problem is i have forgotten most things i learned about it.
I am using PSoC Creater 4.1 and i would love a little help or advice from someone so i can get my head back around it.
I have a simple two track Capacitive switch. It has a center electrode and then a outside trace that is the ground.
I know how to change the pin so it reads the single electrode but i have no idea or understanding how to make the pin next to it perform as the ground pin for this switch.
Also i need to hook up one or two LEDs and what i would like to happen is for the controller to have the capacitive switch and leds plugged in and when the button is pushed/sensed for it to simply turn on the leds while it is being pushed.
I would of loved to of done a proximity sensor as well to light up a seperate LED for backlighting when a hand went near it but i dont think i have the time or skills to implement that as well.
I would appreciate any advice that could be given as i am a bit of a noob with this stuff.
Kind regards,
Darren
Show Less