Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
pshetty
Level 2
Level 2
25 sign-ins 5 questions asked 10 replies posted

Hi,

I have installed T2G_Sample_Driver_Library_7.8.0 for testing the SPI in master mode. Followed the below steps.
1) Opened tviibe1m_flash_cm0plus_cm4_template.eww from ..\T2G_Sample_Driver_Library_7.8.0\tviibe1m\tools\iar\flash directory.
2) Copied ..\T2G_Sample_Driver_Library_7.8.0\tviibe1m\src\examples\scb\spi\High_level_driver_master\main_cm0plus.c into ..\T2G_Sample_Driver_Library_7.8.0\tviibe1m\src folder.
3) Flashed the code into CYT2B7x micro.

Observation:
1) SPI MISO and MOSI are having the same data. Basically I am observing the SPI master behaves as loopback. It means that the data transmitted from SPI master is observed on MISO line. Can you tell me why MOSI data is same as MISO data? Is it the expected behaviour, if  not how to resolve the issue?

Attached is the source file.

Pradeep

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
abhikul
Moderator
Moderator
Moderator
10 solutions authored 25 replies posted First like received

Hello @pshetty 

I have attached one folder called SPI.zip which consists of 3 sub folders:

  1. Master code output
  2. Physical loopback mode
  3. Loopback mode using SPI CTL register
  4. In the first folder, I have tested the same code as you have attached in your query and the only change made is the data part. It was observed that there was no loopback effect observed in this code. Please refer the attached waveforms and SDL register configuration in the same folder. I have also attached code for reference.
  5. In the second folder, by physically shorting the pins using a jumper, the loopback effect was observed in the same code. Please refer the attached waveforms and SDL register configuration in the same folder.
  6. In the third folder, without physically shorting the pins and by setting the LOOPBACK bit in the SPI CTL register, the loopback effect was observed which is also called as internal loopback. The same information is present in the device TRM too. Please refer the attached waveforms and SDL register configuration in the same folder. I have also attached code for reference.
  7. These codes were tested on CYT2B7 device.
  8. Could you please check and confirm are the MISO and MOSI pins are shorten on your custom board?
  9. Also could you please let us know what exactly is your slave device? Is it a board or a sensor?
  10. I request you to check these codes at your end and please let us know about the outcome for the same.

Thanks & Regards

Abhishek Kulkarni

View solution in original post

0 Likes
5 Replies
lock attach
Attachments are accessible only for community members.
abhikul
Moderator
Moderator
Moderator
10 solutions authored 25 replies posted First like received

Hello @pshetty 

1. Could you please let us know what is the slave device you are using in your configuration?

2. In order to work as a loop back mode, there is LOOKBACK bit in SCBx_SPI_CTRL register which needs to be set. Please refer image1 for the same which is taken from the device TRM itself.

3. Could you please check this bit and let us know about the status of this bit?

Thanks & Regards

Abhishek Kulkarni

0 Likes
lock attach
Attachments are accessible only for community members.

Hi Abhishek,

Please find the screen shot of the SPI Control register. The loopback bit is set to false which is what I have configured the SPI master to work. However when I send data from Master(CYT2B73xx), I am reading the same data back over the MISO line. What does it indicates and why it is behaving as loopback mode? I am running this example on our custom board where CYT2B73x is a Master and talking to another slave device in our custom board. Could you please explain me the reason why it is behaving like this? Below is the attached screen shot.

Pradeep

0 Likes
lock attach
Attachments are accessible only for community members.
abhikul
Moderator
Moderator
Moderator
10 solutions authored 25 replies posted First like received

Hello @pshetty 

I have attached one folder called SPI.zip which consists of 3 sub folders:

  1. Master code output
  2. Physical loopback mode
  3. Loopback mode using SPI CTL register
  4. In the first folder, I have tested the same code as you have attached in your query and the only change made is the data part. It was observed that there was no loopback effect observed in this code. Please refer the attached waveforms and SDL register configuration in the same folder. I have also attached code for reference.
  5. In the second folder, by physically shorting the pins using a jumper, the loopback effect was observed in the same code. Please refer the attached waveforms and SDL register configuration in the same folder.
  6. In the third folder, without physically shorting the pins and by setting the LOOPBACK bit in the SPI CTL register, the loopback effect was observed which is also called as internal loopback. The same information is present in the device TRM too. Please refer the attached waveforms and SDL register configuration in the same folder. I have also attached code for reference.
  7. These codes were tested on CYT2B7 device.
  8. Could you please check and confirm are the MISO and MOSI pins are shorten on your custom board?
  9. Also could you please let us know what exactly is your slave device? Is it a board or a sensor?
  10. I request you to check these codes at your end and please let us know about the outcome for the same.

Thanks & Regards

Abhishek Kulkarni

0 Likes
lock attach
Attachments are accessible only for community members.
pshetty
Level 2
Level 2
25 sign-ins 5 questions asked 10 replies posted

Hi Abhishek,

I ran the master code output on the custom board. I see the MISO and MOSI has the same data(screen shot attached). I will do some more test and update you. Also there are no shorts on MISO and MOSI line and I have verified this on the custom board. 

Pradeep

0 Likes
pshetty
Level 2
Level 2
25 sign-ins 5 questions asked 10 replies posted

Hi Abhishek,

I think this is not issue with the CYT2B7 micro. Micro is sending the data properly. Issue is with our setup. Thanks for your help.

Pradeep

0 Likes