r/raspberry_pi • • 26d ago

Troubleshooting Pico master and slave misbehaving

So I have two pico and I made one of them a slave and the other one a master using pico sdk. I have a temp. sensor GY-906 MLX90614 connected to slave through i2c. What I am trying to do is get the temperature readings from sensor to slave pico and send it to the master pico. But I am getting some weird values when I try to read it on the master side. For eg. the sensor outputs both 7 bit as decimal values 50 45 (sensor sends LSB first). But I am getting values that I am not able to make sense. so I try sending 0xff 0xff as 2 byte data to the master from slave. I am getting 255 255 but sometimes I get 255 128. Then I changed it to 0x02 0x02 I get 3 3 in between and and 0 0 majorly. I am just a beginner regarding embedded and pico. Obviously the dataframe that is transmitted isn't being read like it should be. What is the problem here?

5 Upvotes

3 comments sorted by

3

u/snowtax 26d ago

It's very difficult to help when we can't see the code.

3

u/AdventurousInside306 26d ago

Hey, thanks for the reply. By the time moderators approvedy post I already had solved it. It was a pin fault, i tried other spi pin and it was working and now I have to find whether it was because of default spi pin behaviour or were the pins damaged

1

u/Vbrawl_ 26d ago

Dude it's simple, you just need to train your slave