File size: 9,303 Bytes
4a33762
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
  "ticketNumber" : "1000532",
  "reporterName" : "Asher Farooqui",
  "rankPoints" : "1821",
  "resolutionStatus" : "",
  "ticketName" : "TDA2EXEVM: Communication with another SPI slave",
  "rankName" : "Expert",
  "replies" : "",
  "views" : "",
  "queryText" : "Part Number: TDA2EXEVM Other Parts Discussed in Thread: TDA2 Hi, Can you please give some directions on how to share the TDA2 SPI Master (there are 4 SPI Modules that can be Master where each module has support for 4 Slaves (4 CS))? There is an API in Utils_mcspi.c that I am looking at as a reference. Upon boots, the Radar SDK initializes 4 SPI instances using channel 0 (CS0) to set up SPI communications with the 4 attached AWRs. My questions are as follows: 1. Why is it not necessary to call Utils_mcspiOpen() during AWR Init? 2. Why static Utils_mcspiDeviceCommObj gUtils_mcspiDeviceCommObj[UTILS_MCSPI_NUM_DEVICES]; where UTILS_MCSPI_NUM_DEVICES = 8? I thought there are 4 SPI modules only. 3. In my application where I share SPI Module0 using CS1 to communicate with my slave device, I called the Utils_mcspiOpen() specifying the deviceId = 0, mcSpiDevInstNum = 0, mcSpiChannelNum = 1. This resulted in a crash during boot. Debugged into it said the FIFO has already been in use. 4. The thought in calling Utils_mcspiOpen() was because the SPI 4 instances have already been initialized during AWRs setup. I assume I need to call Open() before calling Utils_mcspiRead()/Write(). Thank you in advance,",
  "imageList" : null,
  "partNumber" : "NA",
  "allResponseList" : [ {
    "contentId" : "",
    "userName" : "Stanley Liu",
    "rankPoints" : "50045",
    "rankName" : "TI__Guru",
    "date" : "",
    "userId" : "/members/22243",
    "content" : "Hi, Each McSPI can support up to 4 Master but only 1 Slave. 1. SPI is needed for configuration so as long as it is called before radar configuration step, it is fine. 2. UTILS_MCSPI_NUM_DEVICES is just a number to limit the total number of external devices which can be connected to SPIx, not number of SPI modules. It is just a number we picked. Each McSPI as master can connect up to 4 devices. 3. deviceId is the index of the radar devices, not mcspi instance id. If you already have one radar with CS0 on McSPI1 (mcspi instance 0), this would be deviceId =1. 4. _Init() then _open() to get handle. After that, use the handle to call read/write. Regards, Stanley",
    "imageList" : null
  }, {
    "contentId" : "",
    "userName" : "Asher Farooqui",
    "rankPoints" : "1821",
    "rankName" : "Expert",
    "date" : "",
    "userId" : "/members/6193894",
    "content" : "Hi Stanley, Thanks for the clarifications. Got a bit further. We need a bit more clarity to get this working. 1. is mcSpiChannelNum in Utils_mcspiOpen() the same as ChipSelect? If not, don't I need to specify the CS# on the mcSpi module? 2. I now called Utils_mcspiInit(1) and then called Utils_mcspiOpen(1, 0, 1, edmaHandle) to get a valid SPI handle. This resulted in a UTILS_MCSPI: McSPI GIO Create Failed!! on the console. After it crashed. 3. So looks like we still don't completely understand the API usage. Thanks,",
    "imageList" : null
  }, {
    "contentId" : "",
    "userName" : "Asher Farooqui",
    "rankPoints" : "1821",
    "rankName" : "Expert",
    "date" : "",
    "userId" : "/members/6193894",
    "content" : "Any Suggestions?",
    "imageList" : null
  }, {
    "contentId" : "",
    "userName" : "Stanley Liu",
    "rankPoints" : "50045",
    "rankName" : "TI__Guru",
    "date" : "",
    "userId" : "/members/22243",
    "content" : "Hi Asher, I am not sure I follow what you are trying to implement here. Are you using radar driver in SDK? If yes, radar SPI driver is implemented in ~/pdk_xx_xx_xx_xx/packages/ti/drv/vps/src/devices/radar_ar12xx/src/bspdrv_ar12xxMcspiCfgPriv.c. Only Utils_mcspiInit() is called from use case to add the McSPI instace to GIO device and configure crossbar for interrupt. The instance will be opened later by radar SPI driver in PDK. To configure radar, we use radar APIs from rl_sensor.c in ~/mmwave_dfp/ti/control/mmwavelink/src/rl_sensor.c, which has the callback hooked to radar SPI driver. We don't directly call McSPI APIs from use case since SPI protocol is implemented by radar link layer. Regards, Stanley",
    "imageList" : null
  }, {
    "contentId" : "",
    "userName" : "Stanley Liu",
    "rankPoints" : "50045",
    "rankName" : "TI__Guru",
    "date" : "",
    "userId" : "/members/22243",
    "content" : "In addition, please note that Utils_mcspiInit(UInt32 mcSpiInstNum) where mcSpiInstNum = 0 (McSPI1), 1 (McSPI2), 2...",
    "imageList" : null
  }, {
    "contentId" : "",
    "userName" : "Khai Trinh",
    "rankPoints" : "4140",
    "rankName" : "Genius",
    "date" : "",
    "userId" : "/members/5835029",
    "content" : "Hi Stanley, Sorry for the confusion. Let me start this over again. We would like to use (configure) one of the 4 mcSPI modules on the TDA2 to communicate with a SPI slave device. Please provide steps on how that can be done. We went thru the utils_mcspi.c in radar SDK thinking that that's the API we should be using as awr12xx configuration is using that utils API to configure AWR. We read the TDA2 datasheet and it indicated that each MCSPI module can support 4 slave. Is this not the case? I think you briefly stated that \"Each McSPI can support up to 4 Master but only 1 Slave\". Does that mean we cannot use SPI to talk to our external device over SPI? If this is true, then case close. SPI is not the solution. If mcSPI module can be used, then please provide instructions on how to add a SPI slave to an mcSPI module using chip select knowing that each mcSPI module is a Master to each slave AWR. Thanks, --Khai",
    "imageList" : null
  }, {
    "contentId" : "",
    "userName" : "Stanley Liu",
    "rankPoints" : "50045",
    "rankName" : "TI__Guru",
    "date" : "",
    "userId" : "/members/22243",
    "content" : "Khai Trinh said: We read the TDA2 datasheet and it indicated that each MCSPI module can support 4 slave. Is this not the case? What I meant was when McSPI is the master, it can support up to 4 slave devices with 4 CSn. So, yes, each McSPI module as master can connect to 4 slaves. Which external SPI slave device are you connecting to? Radar or something else? If it is radar, why don't you use our radar SPI driver? Regards, Stanley",
    "imageList" : null
  }, {
    "contentId" : "",
    "userName" : "Khai Trinh",
    "rankPoints" : "4140",
    "rankName" : "Genius",
    "date" : "",
    "userId" : "/members/5835029",
    "content" : "Another SPI slave device. Please provide step-by-step instructions on how to configure it. i have tried Uitls_mcSPI.c API. If you go back to my questions below: Thanks for the clarifications. Got a bit further. We need a bit more clarity to get this working. 1. is mcSpiChannelNum in Utils_mcspiOpen() the same as ChipSelect? If not, don't I need to specify the CS# on the mcSpi module? 2. I now called Utils_mcspiInit(1) and then called Utils_mcspiOpen(1, 0, 1, edmaHandle) to get a valid SPI handle. This resulted in a UTILS_MCSPI: McSPI GIO Create Failed!! on the console. After it crashed. 3. So looks like we still don't completely understand the API usage. Thanks, --Khai You gave some hint on i",
    "imageList" : null
  }, {
    "contentId" : "",
    "userName" : "Khai Trinh",
    "rankPoints" : "4140",
    "rankName" : "Genius",
    "date" : "",
    "userId" : "/members/5835029",
    "content" : "Hi Stanley, Just want to follow on this topic. Can you please advice... The current setup in the SDK is each mcSPI module is a Master on processor side with an AWR as a slave. So 4 mcSPI modules pairing with 4 AWR slaves. That part I don't have to do anything. It's all working as is. Now I need to add another SPI slave device to 1 of the 4 Master. So we need to configure a ChipSelect on the Master side. How that can be done thru the Utils_mcSPI.c API is really my question. I have tried a few things I described above without any luck. If you have an answer, please describe it here so I can try it out. For something like this, a conf call can be much more productive. Thanks,",
    "imageList" : null
  }, {
    "contentId" : "",
    "userName" : "Stanley Liu",
    "rankPoints" : "50045",
    "rankName" : "TI__Guru",
    "date" : "",
    "userId" : "/members/22243",
    "content" : "Hi, Ok. It makes more sense now. 1. You don't have to call Utils_mcspiInit(instId) again because each instance only needs to be initialized once. Since you are using one of the instances which is used by radar, it is already called in ChainsCommon_ar12xxInit(). Make sure you open SPI channel only after ChainsCommon_ar12xxInit(). 2. FIFO mode can be enabled on only one channel per McSPI instance. Utils_mcspiOpen() keeps track of it in its scope. However, Radar driver enables FIFO mode in its own open call outside of Utils_mscpiOpen(). For your use case to work, you have to disable FIFO mode in Utils_mcspiOpen(). You can change the below line in Utils_mcspiOpen() to 1 to disable FIFO mode. static UInt32 fifoEnabled[UTILS_MCSPI_NUM_MCSPI_INST] = {1U, 1U, 1U, 1U}; Please give this a try and see if it works. Regards, Stanley",
    "imageList" : null
  } ],
  "tags" : [ ],
  "fourmType" : "processors-forum"
}