Configuring CY8C9560A EEPROM with POR default settings.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi ,

     I connected three switches to the three GPIOs on the CY8C9560a and LEDs to the 12 of other GPIOs.

So, when ever the switches are pressed ,i'm Toggling the LEDs in different patterns.

Right now, I'm enabling the Interrupt mechanism on the CY8C9560A to generate an interrupt if any changes occur in the GPIO states , which are connected to switches.

I connected the interrupt line to Master Board(Atmel Controller), so , on interrupt i'm reading the interrupt status register and toggling the corresponding LEDs through i2c_write.

My Question is

1. Can i do all these operations without the help of Master device after programming the cypress board?

2. Can we store all the settings in EEPROM and by Power ON Reset  can these operations be handled by the cypress control unit itself.?

    If yes , what type of settings i have to do ?  How to load such settings ?

Thanks  & Regards

R Madhu.samp

0 Likes
1 Solution

Hello Madhu,

There are some corrections to be made in your sequence, as follows

i2c_write_one_byte(0x18,0x01);     // Select Port #1

i2c_write_one_byte(0x1a,0x02);     // Select PWM #2

i2c_write_one_byte(0x1c,0x02);     // Enable Output on P1_2

i2c_write_one_byte(0x28,0x02);     // Select PWM #2, as PWM #2 only can be output on P1_2

i2c_write_one_byte(0x29,0x04);     // Clock from programmable divider

i2c_write_one_byte(0x2a,0x20);     // PWM Period

i2c_write_one_byte(0x2b,0x10);     // PWM pulse Width

i2c_write_one_byte(0x2c,0x80);     // Programmable divider value

This should output around 36Hz on P1_2, with a constant duty cycle of 50%.

In order to vary the intensity of the LED, you should change the pulse width by specifying a new value

i2c_write_one_byte(0x2b,0x18);     // PWM pulse Width

and so on.

Thanks,

Sampath

View solution in original post

0 Likes
4 Replies
SampathS_11
Moderator
Moderator
Moderator
250 sign-ins 250 solutions authored 5 questions asked

Hello Madhu,

Since the CY8C9560A is a peripheral device, it is not designed to store program logic, and hence would not be able to turn on LEDs with respect to the change in switch states.

If you can try your hand in programming, I suggest you use our latest PSoC4 device.

Thanks and regards,

Sampath

Anonymous
Not applicable

Got it, Thanks Sampath.

So, always i have to use the master to the control the the cypress periperal.

Also i am trying to configure the PWM on one of the GPIO , I connected one active low LED to the 1st PIN of Port 1 with a pull-up resistor.

The below steps i followed to activate the PWM,

But i am getting constant voltage on the LED and it glows always, i didn't see any change in the Light intensity.

i2c_write_one_byte(0x18,0x01);

i2c_write_one_byte(0x1a,0x02);

i2c_write_one_byte(0x1c,0x00);

i2c_write_one_byte(0x28,0x03);

i2c_write_one_byte(0x29,0x04);

i2c_write_one_byte(0x2a,0x20);

i2c_write_one_byte(0x2b,0x10);

I expected that light intensity will vary continuously.

So, is that correct ? If not , can you please explain me the general working of the PWM.

and to configure correctly , in the above case ?

Thanks and Regards,

R Madhu.

0 Likes

Hello Madhu,

There are some corrections to be made in your sequence, as follows

i2c_write_one_byte(0x18,0x01);     // Select Port #1

i2c_write_one_byte(0x1a,0x02);     // Select PWM #2

i2c_write_one_byte(0x1c,0x02);     // Enable Output on P1_2

i2c_write_one_byte(0x28,0x02);     // Select PWM #2, as PWM #2 only can be output on P1_2

i2c_write_one_byte(0x29,0x04);     // Clock from programmable divider

i2c_write_one_byte(0x2a,0x20);     // PWM Period

i2c_write_one_byte(0x2b,0x10);     // PWM pulse Width

i2c_write_one_byte(0x2c,0x80);     // Programmable divider value

This should output around 36Hz on P1_2, with a constant duty cycle of 50%.

In order to vary the intensity of the LED, you should change the pulse width by specifying a new value

i2c_write_one_byte(0x2b,0x18);     // PWM pulse Width

and so on.

Thanks,

Sampath

0 Likes
Anonymous
Not applicable

Thanks sampath for lot of information, Now i understood clearly.

The above code and with 2 changes, it is working for me.

As per data sheet Writing 1 into 0x1C , will make that pin as input, so for output i made it zero.

  i2c_write_one_byte(0x1c,0x00);     // Enable Output

Also the 1st pin in the port 1 is connected to PWM_4 Source , so i have to write 0x04 in the 0x28 register

i2c_write_one_byte(0x28,0x04);  // PWM_4 is selected.

And as you mentioned, i can see the variations in the intensity by writing different values in the 0x2b Register.

Thank you once again sampath.

R Madhu

0 Likes