Image by StockSnap via Pixabay
Question from the Customer:I am using the Promira Serial Platform to write an array of 4 bytes of data for a single PMBus transaction. I could use some help with this. I cannot figure out how to add the length of the packet to the ps_i2c_write.
I am writing the API script in Python. The write function is part of a read operation using the PMBus protocol. Here is my code:
ps_i2c_write(channel, device, PS_I2C_NO_STOP, array('B', [pagePlusCmdCode, blockCount, pageCode, cmdCode]))
(ret, data_in, count) = ps_i2c_read(channel, device, PS_I2C_NO_FLAGS, length)
Response from Technical Support:Thank you for your question! There are attributes about Promira Python API we will discuss. In addition, we will go over functional software examples that could be used as is, or modified as needed for your project.
There are two main differences between the Promira API documented in the user manual and the Promira Python API:
There are a variety of ways to call API functions that have array arguments:
The Promira Software API supports three platforms (Windows, Linux, and Mac) several languages (C, Python, C#, and VB) and examples are free for downloading. For more information about each function, refer to API Documentation.
The i2c_eeprom and spi_eeprom scripts could be helpful for your project:
Note – both examples were designed to read/write to the Atmel AT25080A found on the I2C/SPI Activity Board.
Examples of the usage of i2c_eeprom.py:
We hope this answers your questions. 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.