- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody,
for a project, I have to change pins from I2C to GPIO, in order to drive them thorugh FW, because of test procedures in software.
So I set up Pins 4.0 and 4.1 for I2C SCK, and SDA, but, during SW, IF a condition occurs, I have to change 4.0 and 4.1 to GPIOs pins.
So i made this changes...
if (testing)
{
regVal=CY_GET_REG32(CYREG_HSIOM_PORT_SEL4);
regVal&= ~ 0x00000F00u;
// setta il PIN COME GPIO OUTPUT , configurazione del registro
regVal=CY_SET_REG32(CYREG_HSIOM_PORT_SEL4,regVal|(HSIOM_SW_GPIO<<0u));
I2C_scl_SetDriveMode(I2C_scl_DM_STRONG); // output digitale SCL
regVal=CY_GET_REG32(CYREG_HSIOM_PORT_SEL4);
regVal&= ~ 0x00000F00u;
// setta il PIN COME GPIO OUTPUT , configurazione del registro
regVal=CY_SET_REG32(CYREG_HSIOM_PORT_SEL4,regVal|(HSIOM_SW_GPIO<<0u));
I2C_sda_SetDriveMode(I2C_sda_DM_STRONG); // output digitale SDA
}
Then I try to drive these pins by software but is not possible. Have you any ideas or I am not doing something?
Thanks,
David.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Port 4 pins are reserved to the Uart and I2C PSOC Creator will flag them if you try to use them as GPIO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is not quite correct, Bob 😉
You may disable the hardware connection and use the port4 pin with pin_Write() and pin_Read(). This is probably what David wants to do.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bob I have tried this and Psoc Creator complains. But I'll check it again and see what happens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody,
I solved,
The code I wrote is correct except one line...
regVal&= ~ 0x00000F00u;
FOR I2C pin SCL, 4.0
I have to write
regVal&= ~ 0x0000000Fu;
Because I have to write bits concerting to port 4.0 of HSIOM, now it works 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi davide.rossi , thank you for this information.
Do you know if it is possible to do the same with PSoC 5LP ?
I have searched the datasheets and application notes and seems that HSIOM to PSoC 4 is the same as the digital system interconnect (DSI) to PSoC 5. But I have no idea about how to use this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a "Register Technical Reference Manual" which lists *ALL* registers used for setting the design. There ou may find the information for setting the DSI.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a question which may or may nor fit in with this issue?
Bootloader will not work when P4[0] and P4[1] Connected to I2C bus