# LMS\_WriteFPGAReg(device, 0x00C0, 0xFFFE) is not working

**URL:** <https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787>\
**Category:** LimeSDR\
**Created:** [6 December 2022 12:55 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787 "2022-12-06T12:55:52Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yusho](https://yyz2.discourse-cdn.com/flex034/user_avatar/discourse.myriadrf.org/yusho/32/4195_2.png) [@yusho](https://discourse.myriadrf.org/u/yusho)\
**Post date:** [6 December 2022 12:55 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787/1 "2022-12-06T12:55:52Z")

</div>

Hello.  
I am trying to transmit data when GPIO\_0 is high(trigger). But it doesn’t work.  
LimeSDR transmitted data even though I disconnected GPIO pin.

my code is here([github](https://github.com/yusho-nakawaki/Orbital-Angular-Momentum/blob/main/LimeSDR_communication_triggerGPIO.cpp#L151))  
I just add `LMS_WriteFPGAReg` into my code.

Am I missing something??

> [@LimeSDR USB connecting proble..Falshing LEDs](https://discourse.myriadrf.org/t/limesdr-usb-connecting-proble-falshing-leds/5358/12):
>
> Another solution may be to utilize what is implemented in FPGA gateware 2.23 version already. FPGA\_GPIO0 (J22, Pin 1) is used to indicate when data are being transmitted (high level indicates data transmition is active). To activate this you have to write to FPGA register 0x00C0 value 0xFFFE. Then feed this signal to Arduino and you will know when signal is being transmitted.  
> Hope this helps.

 ![Image_20221206_213719_698](https://canada1.discourse-cdn.com/flex034/uploads/myriadrf/original/2X/f/f458e2eaa63e9701e6c01001aa6513df9e6758f9.jpeg)

---

<div class="post-metadata">

**Author:** ![yusho](https://yyz2.discourse-cdn.com/flex034/user_avatar/discourse.myriadrf.org/yusho/32/4195_2.png) [@yusho](https://discourse.myriadrf.org/u/yusho)\
**Post date:** [6 December 2022 12:59 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787/2 "2022-12-06T12:59:54Z")

</div>

@Zack  
Do you know why?

---

<div class="post-metadata">

**Author:** ![yt7pwr](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@yt7pwr](https://discourse.myriadrf.org/u/yt7pwr)\
**Post date:** [6 December 2022 16:28 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787/3 "2022-12-06T16:28:30Z")

</div>

I do not see GPIO\_0 pin init command (set input or output mode). After GPIO is initialized it can be read or write pin state.

---

<div class="post-metadata">

**Author:** ![yusho](https://yyz2.discourse-cdn.com/flex034/user_avatar/discourse.myriadrf.org/yusho/32/4195_2.png) [@yusho](https://discourse.myriadrf.org/u/yusho)\
**Post date:** [7 December 2022 04:14 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787/4 "2022-12-07T04:14:38Z")

</div>

Thank you for replying, yt7pwr.

I still can’t implement.  
I set all pin input mode like this

```auto
uint8_t gpio_dir = 0x00;
LMS_GPIODirWrite(m_device, &gpio_dir, 1);

```

then,

```auto
LMS_WriteFPGAReg(device, 0x00C0, 0xFFFE)

```

But, it doesn’t work. (LimeSDR transmitted data even though I disconnected GPIO pin.)

Is there anything I have to write `wait something` code? or What code should I write?

---

<div class="post-metadata">

**Author:** ![yt7pwr](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@yt7pwr](https://discourse.myriadrf.org/u/yt7pwr)\
**Post date:** [7 December 2022 08:12 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787/5 "2022-12-07T08:12:07Z")

</div>

Use LMS\_GPIORead command to read pin state.

---

<div class="post-metadata">

**Author:** ![RightHalfPlane](https://avatars.discourse-cdn.com/v4/letter/r/46a35a/32.png) [@RightHalfPlane](https://discourse.myriadrf.org/u/RightHalfPlane)\
**Post date:** [7 December 2022 14:56 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787/6 "2022-12-07T14:56:05Z")

</div>

With some devices, you need to set the transmit gain to zero to actually get it to stop transmitting - perhaps that is your problem.

---

<div class="post-metadata">

**Author:** ![yusho](https://yyz2.discourse-cdn.com/flex034/user_avatar/discourse.myriadrf.org/yusho/32/4195_2.png) [@yusho](https://discourse.myriadrf.org/u/yusho)\
**Post date:** [9 December 2022 04:18 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787/7 "2022-12-09T04:18:02Z")

</div>

I set tx gain to zero. But it didn’t work…

---

<div class="post-metadata">

**Author:** ![yusho](https://yyz2.discourse-cdn.com/flex034/user_avatar/discourse.myriadrf.org/yusho/32/4195_2.png) [@yusho](https://discourse.myriadrf.org/u/yusho)\
**Post date:** [9 December 2022 04:36 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787/8 "2022-12-09T04:36:38Z")

</div>

@yt7pwr  
What should I do when read GPIO(LMS\_GPIORead )?  
I did many way but LimeSDR transmit data even though I disconnected GPIO pin.

I want to solve this problem which is two SDR didn’t simultaneously send IQ data. I think it caused by different usb port. I think it can be solve with rendering trigger(transmit when GPIO pin is HIGH), not using usb communication.  
In the future I want to 8x8 MIMO(OAM).

 ![スクリーンショット (235)](https://canada1.discourse-cdn.com/flex034/uploads/myriadrf/original/2X/a/ae1f3616877262aff0849d07522ab4c0e35781f9.png)

---

<div class="post-metadata">

**Author:** ![yt7pwr](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@yt7pwr](https://discourse.myriadrf.org/u/yt7pwr)\
**Post date:** [9 December 2022 11:55 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787/9 "2022-12-09T11:55:28Z")

</div>

Your original question was how to trigger TX with GPIO pins. Read GPIO pin state and you will have trigger information. This is not interrupt but polling system. TX will start when your software start filling transmit buffer and will end when buffer is empty or TX is disabled by command. To sync two devices is complex task, my solution will be to give each device command with exact TX start time but times will be different and you will need sync routine to determine time difference. USB is not syncroniuos system but if you know exact delay and your software and hardware are fast enough result is sync work.

---

<div class="post-metadata">

**Author:** ![yusho](https://yyz2.discourse-cdn.com/flex034/user_avatar/discourse.myriadrf.org/yusho/32/4195_2.png) [@yusho](https://discourse.myriadrf.org/u/yusho)\
**Post date:** [9 December 2022 15:02 UTC](https://discourse.myriadrf.org/t/lms-writefpgareg-device-0x00c0-0xfffe-is-not-working/7787/10 "2022-12-09T15:02:49Z")

</div>

Thank you for your nice replying. I see sync two device is complex task…  
I have no choice but to render IQ data from GPIO pin instead of from USB for syncing multi LimeSDR.

> I modified the FPGA firmware such that four GPIO outputs represent four bits of the TX stream. A TX data packet thus consists of 16 bits in total: 12 bits for the DACs and 4 bits for the GPIO. Importantly, the LimeSuite API already implements streams with 16-bit data, which is natural given the bus width of the USB interface. [from this site](https://www.crowdsupply.com/lime-micro/limesdr/updates/field-report-a-bit-pattern-generator-aligned-with-the-sdr-data-stream)
