This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP-EXP430F5529LP: Reading multiple antennas with RFID

Part Number: MSP-EXP430F5529LP
Other Parts Discussed in Thread: DLP-7970ABP

hi, 

I recently bought MSP-EXP430 and DLP-7970ABP booster boards and am now trying to switch between multiple antennas with Infineon BGS18GA14E6327XTSA1 RF switches. I would like the code to automatically switch between the antennas as fast as possible and do this indefinitely. 

As I am struggling with modifying TIs NFC code to switch between antennas automatically, I hope you could help me a bit.  How should I modify the code so every time it switches the antenna, makes one read and then proceeds to the next one.

Thank you 

  • Hello Zan,

    Please see our antenna multiplexing application note which covers how to handle the switching with our NFC stack as well: www.ti.com/.../sloa231
  • Hello Ralph,

    Thank you for replay.

    I've written the part of the code so that it suits my needs but it seems I've made a mistake and I can't figure where.  

    I started by switching between two antennas. I created switch loop inside for loop just as you can see below but the problem is that program seems to somehow end the first switch case too early.

    I'm sending two more oscilloscope screenshots. In both cases, the yellow signal is  NFC reader signal but since I only have 2 channel scope I couldn't measure all three signals at the same time so on one screenshot there is GPIO pin 1 port 3 and on the other is GPIO port 1 pin 4. As you can see GPIO port 1 pin 3 goes high only for a few ms, when it really should be high every second NFC interval.

    GPIO port 1 pin 3

    GPIO port 1 pin 4

    Thank you!

  • Hello Zan,

    The issue would be your for loop. You are going through both case statements inside of the for loop, and then exiting the for loop and calling the NFC API's. So you end up in the state of Case 2 always when exiting the loop.

    I would remove the for loop entirely, I see no benefit to it.
  • Ok but I actually have the rest of the code in that for loop so that shouldn't be a problem, should it be?

    And even thou, how am I then going to restlessly switch between two antennas (or 20 of them in the final version)? Is there any other solution than for loop?

  • Hello Zan,

    Ah I see, sorry that wasn't clear to me due to the unusual spacing and inconsistency of where the {'s are located. By the way, Ctrl + i in CCS will align all your code with proper spacing.

    I don't think you need that for loop at all, in fact I don't like that for loop idea.

    The while 1 will loop for you and that should be all you need.

    Putting the switch statement within the while(1) will still ensure that you are toggling them each time the while loop processes which is one full iteration of the NFC stack.

    Actually looking at how you have that set, the FOR loop still is the issue, but for a different reason than I stated.

    NFC_run is the API which runs all the NFC commands, turns on the field, etc. - everything after NFC_run is just processing the results at an application level. Therefore you are:

    Turning on NFC, sending commands, etc. (Your long interval in yellow)
    Changing antenna (c=1)
    Processing NFC data received (milliseconds of time)
    Changing antenna (c=2)
    Re-processing the same NFC data as no new data has been received since NFC_run wasn't called
    Restarting the while(1) loop

    Also I would suggest to have the setAsOutputPin API outside of the While(1) loop, it should be a one time configuration. And you also will want to turn on the first antenna as part of the one time config, so the first time NFC_run goes, it is transmitting over the right antenna. Then you can switch after the first NFC_run finishes and give the switcher time to change over while also processing application code.
  • Thank you very much Ralph.

    But as I have switch statement, don't I need an integer like I had 'c' in previous code?
  • Hello Zan,

    You do, but you can increment the integer after the switch statements couldn't you? No need for the for loop to handle the incrementation.
  • Thank you very much, Ralph!

    It's all working as it should now.

    Best regards,

    Žan Hedžet Kostajnšek

**Attention** This is a public forum