I inherited a project that uses the Promira Serial Platform with the SPI Active Level 1 and Level 2 applications. I’m doing my best to learn this device. I could use some assistance, mostly with the GPIO pins.
So far, I have communicated with the Promira platform using static ip and lights.py. I can see the lights on the I2C/SPI Activity Board blinking, and the command line returns “Bitrate set to -13 kz”. I assume the device is working, but other than running this sample of Promira Software API with the board, I am not getting results.
For example, I tried running another script, gpio.py:
When running this, I put the scope on pin 1 (GPIO_0). I see similar behavior as with my code. It goes low when the dev_open is called, but I see no other effect.
I wrote some python code to control a GPIO. I put a scope on the GPIO signal line, and here are the results:
I think the pulse I am seeing is just a result of the dev_open call, not from the ps_app_configure. If I insert an infinite loop right after dev_open, I see the exact same behavior (the pulse low then high). To some level I can communicate with the Promira platform, but the behavior and results are not what I expect.
I feel like I’m playing tug of war. How can I get this to work?
Response from Technical Support:Thank you for your question! The purpose of the lights.py API code is flashing the LEDs attached to a Philips PCA9554D I/O port expander as found on the I2C/SPI Activity Board. From your results with that setup, it looks like your Promira platform is working. We will go over how the GPIO pins work and provide guidelines about programming and verifying the GPIO signals.
The Promira platform pins are open drain and have internal pull-up. Here are the values of the GPIO pins:
When the Promira platform is connected to Control Center Serial Software, configured for GPIO input, and the target device does not drive the Promira platform, GPIO00 reads 1. In this case, the GPIO00 pull-up creates the 1. In the Promira platform enabling or disabling the I2C signal pull-up, it does not affect the GPIO00 / GPIO01 signal. This signal always has a pull-up, which is a separate resistor from the I2C signal pull-up resistor.
With all that in mind, when the Promira platform is connected to Control Center Serial Software and configured to GPIO input, we recommend making sure the target device drives the Promira platform,. That way, the GPIO00 signal reads accordingly.
The GPIO.py script performs simple GPIO tests with a single Promira platform. You can verify results with an oscilloscope or a multimeter.
The ps_gpio_direction script uses the direction_mask argument. This mask must be reflected in the last 16bits. For example, to enable GPIO00 and GPIO03, the mask is 0x01 | 0x08 (00000001 and 00001000). In the bit mask format, GPIO00 is the LSB to GPIO15 to MSB (16th LSB bit). The bit masks are as follows:
With these masks, you can run some simple scripts to test and verify GPIO pin activity.
We hope this answers your question. Additional resources that you may find helpful include the following:
If you want more information, feel free to contact us with your questions, or request a demo that applies to your application.