About GT202

asked 2015-02-03 21:35:38 -0700

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I want to control the GT202 with SPI by my EVBoard. I also implement the SPI API with ajtcl-14.12.00 in aj_spi.c, but I don't know what the exactly action is. I just implement it by my imagination.
My question are as follow:
1. What pins should I make the EVBoard connected to the GT202?
CHIP_PWD(J2.2), GND(J2.14),
3.3V(J4.8, J4.4)
Is there any pins else?

2. When the function "AJ_WSL_SPI_RegisterWrite" is called , what will the correct SPI waveform look like if my functions are well-implement?

Please help...

edit retag flag offensive close merge delete


All your pin connections look correct. I am not sure what you mean by "i don't know what the exact action is". You should not need to change anything in the WSL driver to get this to work (under the WSL folder). Modeling your port after the Arduino DUE is what you need to do. Implementing aj_spi.c for your own platform is the correct way to go. When you call AJ_WSL_SPI_RegisterWrite() is called you should see 4 bytes (1 frame) of data go across the wire. The exact bytes depend on the register your writing to and the data your writing. Again you should not be calling this function directly but you could call it to test if SPI is working correctly. Let me know if this helps.

jprestwo ( 2015-02-05 12:01:23 -0700 )edit

Thanks for your answering!!
I change nothing in WSL driver ,but when the FW goes to the function write_BOOT_PARAM() in aj_wsl_tasks.c, the FW will hang in the while loop in this function.
I uploaded my waveform example at http://ppt.cc/Wldi .
1 .Is it correct that SPI_CS will assert and deassert 7 times in one AJ_WSL_RegisterWrite?
2. After doing the AJ_WSL_RegisteRead 0x200, I see my MISO keep output data 0x47 . When I do the next command AJ_WSL_RegisterWrite, it is still outputing the MISO in the red rectangle in the picture. I am a little confused about the MISO and MOSI moving at the same time.

bling ( 2015-02-05 18:14:38 -0700 )edit

It was very hard to make out the actual bits on your waveform because it wasn't zoomed in but I think I have seen this behavior before. Firstly, CS should not assert/deassert 7 times, but only twice per frame. Once for the first 2 bytes and once for the second 2. The fact that MISO is outputting the same bytes repeatedly it would appear that the WiFi chip has not been turned on (not sure why it does this but it does). Did you de-assert and assert the PWD line prior to any AllJoyn code running? This should be done in AJ_WSL_SPI_InitializeSPIController() after SPI has been setup for your platform (look at STM32 port). By the way, MISO and MOSI will move at the same time. The first 2 bytes of MOSI are the address and the last 2 bytes of either MOSI or MISO are the data ...(more)

jprestwo ( 2015-02-09 10:28:28 -0700 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2015-02-09 17:52:06 -0700

bling gravatar image

updated 2015-02-10 02:37:47 -0700

Thanks a lot for your answering!
I think that I know how to modify the SPI driver. I have a few questions.

  1. What should I do in the function "AJ_WSL_SPI_ISR" and "AJ_WSL_SPI_CHIP_SPI_ISR" in aj_spi.c? I copy the function in bsp\stm32 to mine. Is that right? I never see the functions called.

  2. I have not implemented the function "_AJ_NV_xx" in "aj_target_platform.c". It seems about reading,write,erasing the Flash. Does it means that I have to not only implement the SPI driver function but also have to implement the Flash function?

  3. After fixing the SPI driver problems, my FW will hang in the while loop in the function "AJ_WSL_DriverStart()". Is it because I have not implemented the Flash function?

  4. I want to make my EVBoard+GT202 be able scanned by other devices with WiFi. If I fixed the Flash function problem , all I have to do is to define SOFTAP_SSID in the Alljoyn.c, is it correct?

    Thanks for your help again!!

edit flag offensive delete publish link more


Posting in multiple comments so its readable. 1. AJ_WSL_SPI_ISR is never called. That should probably be removed from all the targets. AJ_WSL_SPI_CHIP_SPI_ISR is called though and in that function you must set g_b_spi_interrupt_data_ready to true and resume the driver task by calling AJ_ResumeTask(AJ_WSL_MBoxListenHandle, TRUE).

jprestwo ( 2015-02-10 11:07:59 -0700 )edit

2. Yes_AJ_NV_* is for NVRAM/Flash functionality. You don't *need* to implement that but if you want any persistent storage you will have to. Any Soft AP functionality depends on it as well. I recommend you do that implementation. (use nvramtest to verify its correct).

jprestwo ( 2015-02-10 11:11:06 -0700 )edit

3. The reason its hanging in that function is because the driver task has not started. This means that it has not received any data over SPI from the GT-202. Check and double check all your SPI settings are correct. (CPHA, CPOL, mode, etc. Look at bsp/stm32/aj_spi.c lines 181-189.

jprestwo ( 2015-02-10 11:11:15 -0700 )edit

4. Yes defining SOFTAP_SSID will bring up an access point.

jprestwo ( 2015-02-10 11:11:26 -0700 )edit

After doing all the porting for these three platforms there was one configuration aspect that made all the difference. It was how the chip select was configured. At least for the DUE, STM32, and K64F the chip select MUST MUST MUST be configured in hardware. Meaning if you are asserting/de-asserting chip select as if its a GPIO line in software it will NOT work. You must let the SPI hardware manipulate the pin. I am still not sure why this is but it is the only way I was able to get it working. One way to check that the GT-202 is on and responding is by either adding a print or setting a breakpoint in aj_wsl_tasks.c line 251 (AJ_WSL_SPI_RegisterRead(AJ_WSL_SPI_REG_WRBUF_SPC_AVA, (uint8_t*)&space);) and seeing what the "space" variable is after the register read. If it is 0xc5b then your on the right track. The hardest part is ...(more)

jprestwo ( 2015-02-10 11:17:56 -0700 )edit

answered 2015-03-02 00:16:58 -0700

matrix3dim gravatar image

One more pin you need to take care is SPI_INT where this provide interrupt signal to host.

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-02-03 21:35:38 -0700

Seen: 523 times

Last updated: Mar 02 '15