Git Product home page Git Product logo

Comments (7)

in-sympathy avatar in-sympathy commented on September 28, 2024 2

So does anybody have a working version of this pifm file either source or compiled one for RasPi 3? 😇

from pirateradio.

dmontenegro avatar dmontenegro commented on September 28, 2024

@SiobhanRamsey I'm trying to make it work in my Pi3 also but I don't know what I have to do extra to listen it in the radio. Its show in ps aux to be running but It doesnt work. Did you figure it out ?

from pirateradio.

in-sympathy avatar in-sympathy commented on September 28, 2024

Cheers, guys, any progress on this one? Badly want to run it on my Pi3 :)
Merry Christmas btw :)

from pirateradio.

d4m4s74 avatar d4m4s74 commented on September 28, 2024

This project is basically abandoned, no updates for 3 years.

from pirateradio.

in-sympathy avatar in-sympathy commented on September 28, 2024

Too bad 😟

from pirateradio.

DavidWhaleMEF avatar DavidWhaleMEF commented on September 28, 2024

The problem is that the C program directly accesses the GPIO memory, and on the Raspberry Pi 2 and Pi 3 they used a different broadcom processor which results in all the memory mapped addresses for the hardware peripherals changing. The method the code uses to access GPIO for example is deprecated (it reads at a specific base address in real memory, which is only valid on the original BCM2835 chip in the Raspberry Pi 1). The Pi 2 uses a BCM2836 and the Pi3 uses yet another different CPU chip.

The recommended way to get the base address of the GPIO peripheral is to read the various magic numbers coded inside the BCM chip firmware, which is mapped into the virtual file /proc/device-tree/soc/ranges

So, the code in this file....

https://github.com/Make-Magazine/PirateRadio/blob/master/pifm.c#L99

Should be modified to read the various magic numbers from the soc file and use those instead.

Here is an example C file where I do this in one of my drivers...

https://github.com/whaleygeek/pyenergenie/blob/master/src/energenie/drv/gpio_rpi.c#L54

void gpio_init()
{
   uint32_t peri_base = BCM2708_PERI_BASE; /* default if device tree not found */
   uint32_t gpio_base;
   FILE* fp;

   /* for RPi2, get peri-base from device tree */
   if ((fp = fopen("/proc/device-tree/soc/ranges", "rb")) != NULL)
   {
      unsigned char buf[4];

      fseek(fp, 4, SEEK_SET);
      if (fread(buf, 1, sizeof(buf), fp) == sizeof(buf))
      {
         peri_base = buf[0]<<24 | buf[1]<<16 | buf[2]<<8 | buf[3];
      }
      fclose(fp);
   }

   gpio_base = peri_base + GPIO_BASE_OFFSET;


   /* open /dev/mem */
   if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) 
   {
      printf("can't open /dev/mem \n");
      exit(-1); //TODO return a result code
   }

   /* mmap GPIO */
   gpio_map = mmap(
      NULL,             //Any adddress in our space will do
      BLOCK_SIZE,       //Map length
      PROT_READ|PROT_WRITE,// Enable reading & writting to mapped memory
      MAP_SHARED,       //Shared with other processes
      mem_fd,           //File to map
      gpio_base         //Offset to GPIO peripheral
   );

   close(mem_fd); //No need to keep mem_fd open after mmap

   if (gpio_map == MAP_FAILED) 
   {
      printf("mmap error %d\n", (int)gpio_map);//errno also set!
      exit(-1); //TODO return a result code
   }

   // Always use volatile pointer!
   gpio = (volatile unsigned *)gpio_map;
}

from pirateradio.

microbit-rosslowe avatar microbit-rosslowe commented on September 28, 2024

@DavidWhaleMEF I don't really have a great understanding of this code, but something like this?

master...04rlowe:patch-1

from pirateradio.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.