Quantcast
Channel: Cypress Semiconductor - PSoC 5 Device Programming
Viewing all 387 articles
Browse latest View live

Flash metadata ...

$
0
0

I'd be eternally grateful if someone could help me out here. I am trying to write bootable application metadata directly to flash for an SD card based bootloader. The system has ECC disabled and uses a CY8C5888LTQ-LP097 (one of the USB stick parts). Whatever I seem to do with flash is failing.

Comments on the code are in-line. First is a snippet showing how writing metadata is tested, then the code for flashing the metadata structure itself.

TAIA

Jerry.

        // structure to manage metadata as per http://www.cypress.com/file/44531/download P21
        PSOC5_Metadata metadata;
        // fill with checkbyte
        memset(&metadata,0xEE,sizeof(PSOC5_Metadata));
        // first get existing metadata. this works, we get valid numbers.
        uint32 length = Bootloader_GetMetadata(Bootloader_GET_BTLDB_LENGTH,0);
        uint32 checksum = Bootloader_GetMetadata(Bootloader_GET_BTLDB_CHECKSUM,0);
        // update using our own API
        metadata.ActiveApplication = 1;
        metadata.AppCheckSum = checksum;
        metadata.AppLength = length;
        metadata.AppAddress = Bootloader_GetMetadata(Bootloader_GET_BTLDB_ADDR,0);
        // status returns CYRET_SUCCESS
        status = UpdateMetadata(0,&metadata);
        // and check again. these values now come back as zero (!)
        length = Bootloader_GetMetadata(Bootloader_GET_BTLDB_LENGTH,0);
        checksum = Bootloader_GetMetadata(Bootloader_GET_BTLDB_CHECKSUM,0);
        // this (predictably) fails
        status = Bootloader_ValidateBootloadable(0);


 

// full row buffer
uint8 metaBuf[CYDEV_FLS_ROW_SIZE];

cystatus UpdateMetadata(int appId,PSOC5_Metadata* metadata)
{
    PSOC5_Metadata* pc = 0;
    cystatus status = CySetTemp();
    if (status != CYRET_SUCCESS)
    {
        return status;
    }
    //
    size_t bytes = sizeof(PSOC5_Metadata);
    // clear buffer
    memset(&metaBuf[0],0,CYDEV_FLS_ROW_SIZE);
    // copy in metadata
    memcpy(&metaBuf[0],metadata,bytes);
    // choose which row to update
    uint16 row = Bootloader_MD_ROW_NUM(appId);
    // Update metadata in flash
    status = CyWriteRowData(Bootloader_MD_FLASH_ARRAY_NUM, row, metaBuf);
    //
    CyFlushCache();
    // sanity check ...
    pc = (PSOC5_Metadata*) &metaBuf[0];
    //
    return status;
}



Generating S Curves or Ramps using PSOC hardware

$
0
0

I am using a stepper driver (drv8825) to drive a stepper motor using a pwm component to generate the pulses and a counter to count the pulses. I want to accelerate and decelerate the stepper by varying the frequency of the PWM. There are multiple ways to do this through software however I want to know if there is a way to do this with minimum use of the CPU.  Can the digital filter block be used to achieve this? 

 

UART Bootloader

SPI MISO

$
0
0

Hello,

I want to read exactly what is on the MISO line right after it is transmitted. What is the method for doing this? For example I send 0x9700 over MOSI and then the MISO that comes back should be 0x0C04. I want to capture this 0x0C04 right when it comes in

Config flash area clarification?

Source code for Bootloader DLL

$
0
0

Hi,

Looking for the source code for the bootloader dll.

I can find instructions on how to complie it, but not the code it's self.

Anyone got a link?

Cheers,

Ric

PWM signals with 90° phase shift

$
0
0

Hi,

i am trying to build an encoder signal generator, with A-, B-, and Z- signal.

The square wave frequency of the the A-, B- signals should be adjustable while running the signal generator (max. 1MHz).

My problem is to create square waves, that are shifted 90° degrees to each other.

I tried it with two PWM UDB blocks:

PWM block 1: I configured a dual Output PWM, where the first output is a 50% duty cycle PWM (A-Signal) and the second output a 75% duty cycle PWM. 

PWM block 2: Configured as 50% duty cycle PWM (B-Signal). The start trigger input of PWM Block 2 is connected to the second output of PWM block 1 (75% duty cycle).  

When i measure the phase shift between A- and B- Signal it will be near 90° (frequencies lower than 100kHz), but when i increase the frequency (1MHz) the phase shift between A- and B- signal drifts away to 100°.

 

By the way:

i read in the values of a qudrature encoder, these values are used to set the periods of the PWM blocks, so i can adjust the PWM frequencies. 

For example:

quadrature encoder value: 32

PWM block 1 period: 32

PWM block 1 compare value 1: 16

PWM block 1 compare value 2: 24

PWM block 2 period: 32

PWM block 2 compare value 1: 16

 

Does anyone know why the phase shift between A- and B-signal increases with higher frequencies?

Is there a better way to implement a encoder signal generator, maybe without PWM? 

 

Sincerly,

manuel

 

 

Finding out COM port

$
0
0

I am using the USB-UART component for a project.  Is there any way that the PSOC can tell which COM port the PC has assigned to it?  I would like to show that value on a LCD screen that I have connected.  I figure the PSoC should know which COM port it was assigned (although I am not a USB expert).  I'm just trying to get that value.

 

Thanks!

jk


PSoC 5 to Serial NOR Code Example

$
0
0

Dear Sirs,

I'm trying to connect a Serial NOR memory Device (S25FL512SAGMFI011) to a PSoC 5LP (CY8C5467LTI-LP003) through the SPI.

But Serial NOR are very complex devices and I would need some code example to start.

Does anyone know where to find an example for PSoC 5LP?

Thank you very much.

Graziano G. Ravizza

Need help on AN66444

$
0
0

I am trying to implement application note AN66444 in my project that require an accurate voltmeter.

Following is the code segment from main.c downloaded with AN66444:-

     { ...................

    /*perform CDS*/
        iVcds = iVout1 - iVout2;
        
        /* IIR Filter*/
        iVcds_curr = iVcds;
        iVcds_acc += (iVcds_curr - iVcds_acc) >> 4;
        }
    
    /*Display output in desired format on UART*/
    fVcds = ADC_DelSig_1_CountsTo_Volts(iVout1);
    UART_1_PutChar('\r');
    UART_1_PutChar('\n');
    sprintf(caVcds_decimal_str,"%f",(float)fVcds);
    UART_1_PutString((uint8*)caVcds_decimal_str);

The display routine is displaying "iVout1".

I could not find any link between the "IIR routine" and the "display routine".

Would greatly appreciate if someone can help me on how the IIR Filter is being used here ?

Psoc5 USB Question

$
0
0

Hello, this is my first post on the forums. There have been many helpful posts, but I have run into some things that I cannot find online or in the documentation. 

 

I am working on a USB device on the CY8CKIT-059 and it is a wonderful little device! I was able to use the example keyboard descriptor to create a small keyboard. 

Now I am working on modifying the descriptor to work with a different message type. I am using a descriptior that is quite common and documented elsewhere. It also works with other controllers without issue. 

Now that I have entered the descriptor in my USBFS component, and switched over to the new descriptor, as well as modified the code, I am unable to receive acknowledgment from the computer (the USB device is showing properly in the device manager in Windows using the default HID driver). 

The new Descriptor should work fine with the existing default windows HID keyboard driver as well. 

The question here is, that if _bGetEPAckState fails to return true, and never receives and acknowledgment, would that mean there is a problem with my descriptor or the data I sent via _LoadInEP?

 

Here is a simplified version of the code I am using to send the structure data. I know the code is a bit rough, but I am using this currently jsut to get the concept tested before a full implementation:

 

struct Report{
    uint8 ModKeyMap[1];     // One byte for mod keys (1 size count 8)
    uint8 LedState[1];      // One byte for LED state (size 1 count 5 padded 3) 
    uint8 bitmap[15];       // 128 keys (size 1 count 120 length)
};

struct Report keyReport;

void SendCodes(){
    uint8 buf[sizeof(keyReport)];
    memcpy(buf, &keyReport, sizeof(keyReport));
    USB_LoadInEP(1,buf, sizeof(buf));
    while(!USB_bGetEPAckState(1));
}

 

Edit:

Also after changing the report size, is there any other value I need to modify in PSoC Creator to tell it that the new report is a difgferent size?

 

 

Updating the VID and PID.

$
0
0

Previously I had been working on the composite device in AN58726. I
got it to build and download ok. The issue that I found was that if
I changed the Vid or Pid, rebuilt, and reprogrammed the board; when
testing with other test tools the Vid and Pid were not updated. So
is there another step that I might have missed to change the Vid
and Pid ?

If I change the Vid and Pid in the KitProg.inf file is this enough
to update the information ?

Randy Seedle

I have a CY8CKIT-059 PSOC 5LP board.

 

MiniProg3 not recognising PSoC5, "Arm Debug Port"

$
0
0

Hi all,

I'd be very grateful for any assistance...

I have a design with PSoC5s. Yesterday in the lab at work everything was good, I could program and debug using the 5 pin SWD interface.

Today, I connect to the board and the MiniProg3 isn't recognising the PSoC. Instead of my PSoC 5 I see "ARM Debug Port" and the helpful tip "This device was recognized (sic), but PSoC Creator does not support it at this time."

Yesterday I got as far as flashing LEDs on my board (woohoo!) I know the PSoCs and power is good as they still flash. Flashing stops when I connect the MiniProg. I have multiple PSoCs on this board. Same problem on all devices.

 

Windows 7 may have installed a new driver for the MiniProg3 this morning.  According to Device Manager, the driver details are:

Provider: Cypress

Date 05/06/2009

Version 3.4.1.20

 

So far this morning, I've uninstalled and reinstalled the driver. I've uninstalled Creator 4.0 and installed 4.1 and I've used PSoC Programmer to check the firmware level on my MiniProg. 

The device is board powered, used reset to connect and I've tried playing with the MiniProg clock frequency.

 

I'm stumped, can anyone help please?

problem placing ISR code in RAM

$
0
0

I wanted to place my ISR in RAM to speed it up as defined here: http://www.cypress.com/blog/psoc-insiders-blog/running-code-ram-using-ps...

Rather than define the interrupt code in the header file I decided to place the simple code in the main source file as follows:

CY_ISR(isr_1_Handler) __attribute__ ((section(".data")));

CY_ISR(isr_1_Handler){...}

This doesnt compile unlike CY_ISR(isr_1_Interrupt) which is implemented in a separate header file. Is there any way to place the ISR as mentioned above in RAM? 

 

 

CRC calculation


Counter not always handling capture

$
0
0

 I'm working on a project, R/C control of a device, non disclosure and such.  I'm giving as much info as I can.

 The transmitter/receiver pair turn joystick position into a pulse that measures approximately 1 millisecond to 2 milliseconds in width (hard stop to hard stop).

 I am using an up counter in one shot mode, with rising edge enabling the counter through a FF, and a capture triggered by the falling edge through an inverter (not).  I am interrupting on capture.  I have 6 of these, in total using 79.2% of the UDB resources,for  2 sars, 2 lookup tables (LUT), 8 counters, some clocks, etc.

  The circuit fragment giving me the problem is attached as a .png.  It is under PSOC Creator 4.0.

  This works most of the time.  Sometimes the capture never triggers.  I have an ISR on the terminal count and it always triggers at the terminal count.  (I use pins for debug output, 100mhz oscilloscope and a cheap Saleae logic analyzer to prove the issue.)

  I was getting a timing violation warning with 24mhz clock into the counter clock, but I dropped that to 12 mhz and the violation went away. The AC characteristics datasheet says it can do 33mhz, but PSOC Creator 4.0 does not believe the data sheet. (Note: the PNG shows 24mhz as I have not yet re-labeled the wire.)

This turns out to not be an issue, because I don't use the bogus value due to not having received it through an interrupt.  I can't share the project, but the circuit is simple enough.  However, it is annoying, and either points directly in my face, or to possible underlying issues with the verilog compiler/placer.

Any suggestions as to a fix?   During my debugging sessions *sometimes* adding an output pin to the input net fixed the problem, but that was when I was getting timing violations.  Now it makes no difference.

 

Attachments: 

PSOC 5LP Evaluation Board (cy8c5888lti-lp097) and boost converter

$
0
0

Hi there,

I'm wondering if it is possible to use the PSOC 5LP evaluation board to run the board at 5V from a 3.3V input without external components. I see that the PSOC 5LP has a boost converter which could boost the voltage to 5V, but it seems like Vbat, Vdd, and Vddio are all connected on the evaluation board.

Best RTOS for PSoC lp5...

Clarification for Bootloader using USBUART

$
0
0

Hi,

I have a USBUART working on my project that is used for processing config commands form a PC. (Only used when changes need to be made to program parameters).

I would like to add a bootloader using the USBUART. Do I simply follow the app instructions as though I am using a standard com port?

Or, are there some additional settings I need to make or will the bootloader set up the correct buffer size etc required when it is invoked?

Ideally, the program would wait at start for several seconds to see if bootloader host is available and after timeout then run the normal code.

I assume either the BL in the project sends a command so the host knows it is ready, or visa-versa and the host sends bytes to see if project is connected?

Thanks

 

 

i2c problem

$
0
0

I was trying to hook up a cy8ckit-059 to a mpu6050 and stumbled upon an example a user posted here:

http://www.cypress.com/forum/psoc-5-device-programming/newb-reading-valu...

I modified it to fit the psoc5 and changed the order of functions for initialization.

I stepped through the program and narrowed the problem down to the following two lines:
I2C_MPU6050_MasterSendStart(devAddr, I2C_MPU6050_WRITE_XFER_MODE);
I2C_MPU6050_MasterWriteByte(regAddr);

The start is sent without error however the second function call fails with I2C_MSTR_NOT_READY. 

Any ideas what could be going wrong? I have attached my project below

 

Viewing all 387 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>