MA55xx library incompatible with AdafruitST5537 library??

I am using Adafruit 1.8TFT and MS5535 on same Teensy 3.1 board. But can not make work the devices correctely together.

I think it is CS problem, seem AdafruitST7735 is somehow preventing me from manualy manipulating CS for the sensor. As soon as I initialize the tft I lost sensor data. Does someone know how to solve this problem?

I attach the library and examples. The MS55xx eksample is MS5541 modified library to work with MS5535 too on Teensy 3.1 board. The example for mentioned problem is MA55xx_underwater_test

MS55xx_underwater_test.zip (6.19 KB)

A quick look at the MS55 code shows a hard coded digitalWrite(6, HIGH/LOW); which is probably the CS.

That should be a parameter of the class - or you can recode it to the pin you need.

(saw that I did help with this lib in some era long ago)

Yes you helped creators off the library time agoo. I only changed it to work on both sensors.
And chaged it a bit to work on Teensy 3.1 too.

Ok, in the mean time I did some chagnes to Adafruit_ST7735 library - adding SPI.beginTransaction() and SPI.endTransaction() wherever something is sent to the SPI. Same I tried to do with the MS55xx library, but no change in sensor data. Will try to make the CS a class parameter instead of hadcoding it.
But do not think that would change anything.... untill I added TFT library and initiated it reading of sensor worked very well.

I did try to make the CS pins parameters, but no change.

Hm.....trying to recode the library to use Class parameters I found something is wrong probably with library... so will rewrite it completely. Transcribe it complete with cs and mclk for sensor passing as Class parameters. Seem for some strange reason actual library can not be changed to use parameters....compiler does not see them.

Please can you check the files if everything correctely put together?

I recoded the sensor library to use parameters, but no better. Still TFT library taking over and not alowing pressure sensor to be read.

Does the TFT work if it is used standalone?

Could it be that the TFT screen has a pull up or pull down resistor for its own use that interferes with the signal of the MA%%xx?

Yes tft and pressure sensor works stadalone. Problem is, pressure sensor is unreachable from moment I initialize TFT.

on which pin you mean? RST I think is manipulated always before the data are sent to tft if I understood correct the tft library.

Can you please look in the code. I am attaching here the complete library and the tft library I use.

MS55xxNew.zip (102 KB)

FYI I do not have such TFT so I can only think what theoretically can be wrong..

TFT -
#define settings SPISettings(4000000, MSBFIRST, SPI_MODE0)

SENSOR
#define spisettingsWrite SPISettings(500000, MSBFIRST, SPI_MODE0)
#define spisettingsRead SPISettings(500000, MSBFIRST, SPI_MODE1)

it seems that the TFT outraces the SENSOR.

Try setting the TFT setting to 500 000 iso 4 000 000

Hi Rob, thanks for answer. Like this?

#define settings SPISettings(500000 iso 4000000,MSBFIRST,SPI_MODE0);

Will try this to see if it works. Can you see if something else is wrong in TFT library?

edit: tried that and get error .... probably wrong sintaxsa... too newbie .... how should I write?

Igor P

TFT -
#define settings SPISettings(500000, MSBFIRST, SPI_MODE0)

other thought:

The sensor probably switches between read mode (most of the time) and write mode while the TFT only supports write mode.

That means that you might need to rewrite both libraries in such a way that before every read/write operation the settings are set again.

I tried with 500000 frequency in TFT settings but no better.

Same I have normal swithching of settings between read and write .... it is all seen in MS55xxNew.zip I posted.

Please can you look at the files I posted and tell me if there is somwthing wrong writen in them?

Igor P

I have looked at the files before and did not see anything wrong.
However as I do not have either the sensor nor the TFT I can not test the code.

which constructor do you use for the TFT?

i use yhe HW SPI same as for pressure sensor...

Ok, good newes!!
Adafruit updated thrir library per last standards in SPI communication and now I finaly have a solution iny hands. Will post links to the thread with updated ST7735 library and new version of MS55xx library updated to same standard.

Thanks to all that tried to behelpful!!

Igor P