LimeSDR-Mini - GPIO Read Not Supported

Hi,

When I run the gpio_example below I get the following output saying that the command is not supported.

Devices found: 1
Reference clock 40.00 MHz
Read current GPIO state:
Command not supported

It appears from this file as though the API calls just haven’t been implemented yet. Is this the case?

Thanks.

GPIO Read-Write is not supported yet. These functions must be implemented in FPGA, hope in next release.

1 Like

Do we have any update on when GPIO support will be provided for the Lime Mini?

I have spent the morning building the switching interface that I am going to use with the GPIO to switch transmit amplifiers in my Digital (DVB-S/S2) TV Transmitter, and soldering it to my Lime Mini (high stress activity!), then the last 2 hours trying to work out why my code did not work.

It’s a little frustrating when the example code provided by Myriad RF does not work - and there is no warning that it will not!

Dave, G8GKQ

If you are developer then Limesuite library will give you exception and text that GPIO Read-Write command is not supported.

@yt7pwr Thanks Goran

Yes - I saw the message, but I thought that it was the way that I had called it that was not supported - not the function itself.

A more useful error message might be “Command not yet implemented”

Do we know when it might be available? A number of Raspberry Pi + LimeSDR TV transmitter
(the Portsdown transmitter here: Portsdown Transmitter Wiki) users have asked me to implement the switching - and we were thinking of designing some custom hardware for the interface.

Thanks, Dave

GPIO read-write is in FPGA. You can copy-modify code from LimeSDR-USB gateware and play with FPGA build tools, not a easy task :frowning: or you can wait for official support. Unfortunatelly Ham radio it’s not interesting from commercial point of view :frowning: so we must be patient.

If you were comfortable modifying the NIOS firmware one really quick and nasty way to do it with really minimal modification and understanding of the command system is the following:

Assuming you don’t ever want to be able to set the VCTCXO DAC to 0 or 1, which is unlikely, you could add a if statement to the firmware in the place where the DAC is updated with the new value over SPI and in the case that it is 0 or 1, dont update the DAC and toggle the GPIO accordingly.

You could then flash this image to your fpga. On the PC call LMS_WriteVCTCXO(0) or LMS_WriteVCTCXO(1) to set the GPIO to 0 or 1 from your C++ code.

Its very horrible but if you need it fast it would work and only require the insertion of a single if statement into the NIOS fw.

Thanks both for the suggestions. I’m not going to play with the FPGA images yet - I’m having enough trouble making sure that the stock ones behave!

A shame about the the low priority for hobby usage when I had understood that it was the hobbyist buzz that was a major factor in reaching the early crowdfunding targets. However, it is a great piece of kit for Digital Amateur TV transmission, so I won’t complain too loudly!

Dave

GPIO commands are currently not implemented in NIOS firmware (like for LimeSDR-USB or LimeSDR-PCIe) for LimeSDR-Mini. However it should be possible to control GPIO by writting to FPGA registers. I have made a commit that turns API GPIO commands into FPGA register writes/reads for LimeSDR-Mini.

Great start,

Just seen the commit and was wondering is this also for the edge egpio pins or just for the 8 grouped together?

Next to that, any example somewhere?

This is only for the 8 grouped together, I will chack if 2 on the edge (EGPIO(0-1)) can also be controlled.

@IgnasJ Thanks very much for the LimeSDR-Mini GPIO commit!

I can confirm that it works in my application, seen here on my test rig setting bits 0, 2 and 7 (the PTT).

Thanks again, Dave

3 Likes

2 GPIO pins on the edge can also be controlled and I have updated LimeSuite to allow control. You will need to use two bytes in GPIO commands to access them though.

LimeSDR GPIO control example that deals with 8 GPIO pins can be found:

1 Like

@IgnasJ Thanks so much, will give it a try if i find some time this weekend.

Just came 2 mind, the underpopulated LED2 (bottom) could also be used as register controlled GPIO? Or is it just a mirror of the top LED both connected to B9/D8 for Red and Green.

And if i may suggest a feature request for the next FPGA gateway release, please consider implementing I2C as option next to just GPIO if possible. That would open up the possibility for users to connect a lot of slower speed devices (GPIO extender, I2C ADC for power/swr measurements, OLED display, etc)

Been trying to get this working with limited success up until now.

What i got working is outputs on the 8 pins, just like Dave. As well as some other output combinations. These seem to work fine from both: the cpp GPIO example and the LimeSuiteGui board control(selected LIME-USB instead LIME-MINI)
@DaveG8GKQ have you tested input as well?

All tough when set to input i always get a HIGH value on all 8 pins, the measured voltage is 0V on the pin and the input value stays high regardless of me pulling the pin to GND or 3V3.

Hi @pauluzs
No, sorry - my application only needs to write to the GPIO, and I don’t have the circuitry installed to set any of them to 3v3.
Dave

No problem,
Just simply used a 1k resistor between the pin and the 3v3 or GND on the edge of the board.

I’m still not sure if this is a hardware issue with my limeSDRmini or a software one. Guess last one, because outputs do work.

Probably best to test on the 8 GPIO’s first, before using the EGPIO’s
So if someone is willing to try please let me know your results.

Found some useful registry documentation on github under: Register description of periphcfg module.

For quick testing i used the LimeSuiteGui SPI Module. This allows control of the 8 GPIO’s, 2 EGPIO’s, the LED and the FAN pins. Albeit still just as outputs.

For input still no luck
0x00C2 stays at 03FF (all high)
0x00C4 is set to 0000 (all input)
0x00C6 tried both 0000 and 03FF (no difference)

Limesdr Mini V1.1 GW 1.27
LimeSuite 18.10.0 build from source 2018-11-11

2 Likes

Good work … love to hear things like this …

1 Like

I can confirm that LMS_GPIODirWrite and LMS_GPIOWrite work with both LimeSDR Mini and LimeSDR USB. I am using the commands to set the GPIOs to achieve band switching between different (narrow-band) Power Amplifiers after the LimeSDR. My code fragment:

// Set up GPIOs for output
uint8_t gpio_dir = 0x8F; // set the 4 LSBs and the MSB to write
if (LMS_GPIODirWrite(device, &gpio_dir, 1) != 0)
{
	fprintf(stderr, "LMS_SetupStream() : %s\n", LMS_GetLastErrorMessage());
	return 1;
}

// Set band - gpio_band declared and set earlier
if (LMS_GPIOWrite(device, &gpio_band, 1)!=0)
{
	fprintf(stderr, "LMS_SetupStream() : %s\n", LMS_GetLastErrorMessage());
	return 1;
}

I have tried to read from the GPIOs but not succeeded; however I do not need this for my application.

Thanks to all at MyriadRF for your support.

Dave, G8GKQ

2 Likes