# Write to CSR (fpga) from software

**URL:** <https://discourse.myriadrf.org/t/write-to-csr-fpga-from-software/13073>\
**Category:** LimeSDR\
**Created:** [16 March 2026 16:29 UTC](https://discourse.myriadrf.org/t/write-to-csr-fpga-from-software/13073 "2026-03-16T16:29:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gear](https://avatars.discourse-cdn.com/v4/letter/g/9de0a6/32.png) [@gear](https://discourse.myriadrf.org/u/gear)\
**Post date:** [16 March 2026 16:29 UTC](https://discourse.myriadrf.org/t/write-to-csr-fpga-from-software/13073/1 "2026-03-16T16:29:18Z")

</div>

Is there a way to write and read to a custom CSR register on the FPGA (LimeSDR XTRX v1.2) with the LimeSuiteNG software?

I am trying to write some custom module on the RX pipeline following the example (adding an fft module). I have the LimeSDR XTRX connected with an Raspberry pi.

> **[Example: Adding an FFT Module — LimeSDR FPGA Gateware (LimeSDR\_GW) 24.09...](https://limesdrgw.myriadrf.org/docs/fft_example)**

I also tried to add a CSR register in the LimeSDR\_GW code in the LimeTop.py module:

self.output\_mode = CSRStorage(size=16, reset=10, description=“Chooses output mode”)

I find in the generated csr.json:

“lime\_top\_output\_mode”: {“addr”: 4026552652, “size”: 1, “type”: “rw”},

and in a generated csr.h file I find:

static inline uint32\_t lime\_top\_output\_mode\_read(void) {  
return csr\_read\_simple((CSR\_BASE + 0x514cL));  
}

static inline void lime\_top\_output\_mode\_write(uint32\_t v) {  
csr\_write\_simple(v, (CSR\_BASE + 0x514cL));  
}

It looks like there are logic generated, on the FPGA Software/Hardware system to write to the custom CSR register. My question is how to interact with the system from the Raspberry pi host, to write to the CSR register. When I tried to use limeGUI (CSR and limeSPI) to write to the register, nothing happens. It is possible to read from some low address value registers.

Do I somehow have to map some of the low address registers to my custom registers which the post implies?

> [@LimeSDR-USB FPGA register map](https://discourse.myriadrf.org/t/limesdr-usb-fpga-register-map/7327):
>
> CC @andrewback I’m trying to add some custom logic into my LimeSDR-USB and need to access a register. Reading through the RTL I’ve seen that register 24 is spare, and I have successfully used LMS\_ReadFPGAReg and LMS\_WriteFPGAReg to verify R/W operation here. My question, is there a register map in documentation where this is laid out ? Is there a more general access method for accessing any register (in LMS7002M, FPGA, FX3 etc). Is there any support for self clearing registers ? What about …

---

<div class="post-metadata">

**Author:** ![VytautasB](https://avatars.discourse-cdn.com/v4/letter/v/ccd318/32.png) [@VytautasB](https://discourse.myriadrf.org/u/VytautasB)\
**Post date:** [17 March 2026 08:24 UTC](https://discourse.myriadrf.org/t/write-to-csr-fpga-from-software/13073/2 "2026-03-17T08:24:45Z")

</div>

Hi @gear,

yes, you can use limeCSR from command line and CSR from limeGUI.

First check if you are using correct CSR address. In your case address would be:  
CSR\_BASE + 0x514c=0x00000000f000514c (I am assuming that CSR\_BASE was not changed and it is 0xf0000000)

to use limeCSR from command line:

```auto
./limeCSR read --stream 00000000F000514c

./limeCSR write --stream 00000000F000514c0000000000000003

```

Note that in limeCSR you have to use 8byte word for read and 16byte for write without 0x prefix. Check `limeCSR --help` for details.

---

<div class="post-metadata">

**Author:** ![gear](https://avatars.discourse-cdn.com/v4/letter/g/9de0a6/32.png) [@gear](https://discourse.myriadrf.org/u/gear)\
**Post date:** [17 March 2026 12:43 UTC](https://discourse.myriadrf.org/t/write-to-csr-fpga-from-software/13073/3 "2026-03-17T12:43:50Z")

</div>

I tried the limeCSR commands and it works writing and reading to/from the CSR register. I tested in command line (limeCSR) and CSR in limeGUI, both works. Thank you @VytautasB .
