September 20, 2019, 06:21:02 am

News:

Have you visited the Allwinner Chipset wiki? - http://linux-sunxi.org/


Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - aleale97

1
I will try to install this in my home file and web server, hope everything works well!
2
General Discussion / Re: Accessing cubietruck registers
February 08, 2015, 05:21:29 pm
Thx for the help, i'm going to attach to this post the GPIO library for cubietruck that i wrote and tested. Its not meant for beginners but it is working  :)

Ill see this register you say even if it seems that with defaults i should have output anyway. ;)
3
General Discussion / Accessing cubietruck registers
January 25, 2015, 04:14:46 pm
Hi all!
I want to use Cubietruck as controller for a robot and i would like to write code in a bare-metal (or similar) variant.
I tryied accessing register but i still can't get a PWM output, here is my code:

/* Author: Alessandro Rossetti */
/* Closing in: 25/01/2015 */
using namespace std;
#include <iostream>
#include <sys/mman.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/file.h>
#include <iomanip>

#define PWM_PAGE 0x1C20000
#define PWM_OFFSET 0xE00
#define PWM_LENGHT PWM_OFFSET+0xB

#define CH0_ENABLE 16
#define CH1_ENABLE 524288

#define CH0_PULSESTART 256
#define CH1_PULSESTART 8388608

#define LOWSPEED 393228
#define DONTMASK 2097216
#define ACTIVEHIGH 1048608

void printLine(char testo[50]) {
    int lenght = strlen(testo);
    int toAdd = (50 - lenght) / 2 - 2;
    for (int cnt=0; cnt < toAdd; cnt++) {
        cout << '-';
    }
    cout << " " << testo << " ";
    for (int cnt=0; cnt < toAdd; cnt++) {
        cout << '-';
    }
    cout << endl;
}

int main() {
   
    int *ctrl;
    int *ch0, *ch1;
   
    //Opening file
    int MemFile = open("/dev/mem", O_RDWR | O_SYNC);
    if (!MemFile) return 1;
   
    //Mapping memory
    void *mapped = mmap(NULL, PWM_LENGHT, PROT_READ | PROT_WRITE, MAP_SHARED, MemFile, PWM_PAGE);
    if (mapped == MAP_FAILED) return 2;

    //Adding offset
    mapped += PWM_OFFSET;
   
    //Initializing pointers
    ctrl = (int *) mapped;
    ch0 = (int *) (mapped + 4);
    ch1 = (int *) (mapped + 8);

    //Output of mapped addresses
    printLine("Addresses");
    cout << "Control Register: " << ctrl << endl;
    cout << "CH0 : " << ch0 << endl;
    cout << "CH1 : " << ch1 << endl;
    printLine("");
   
    //Print of Values
    printLine("Values");
    cout << "Control Register: " << *ctrl << endl;
    cout << "CH0 : " << *ch0 << endl;
    cout << "CH1 : " << *ch1 << endl;
    printLine("");
   
    //Assign
    *ch0 = 65538;
    *ch1 = 131073;
    *ctrl = 0 | CH0_ENABLE | CH1_ENABLE | CH0_PULSESTART | CH1_PULSESTART | LOWSPEED | DONTMASK | ACTIVEHIGH;
   
    //Print after CTRL setup
    printLine("After CTRL Setup");
    cout << "Control Register: " << *ctrl << endl;
    cout << "Should be: " << (0 | CH0_ENABLE | CH1_ENABLE | CH0_PULSESTART | CH1_PULSESTART | LOWSPEED | DONTMASK | ACTIVEHIGH) << endl;
    cout << "CH0 : " << *ch0 << endl;
    cout << "CH1 : " << *ch1 << endl;
    printLine("");
   
    //Exit
    munmap(mapped-PWM_OFFSET, PWM_LENGHT);
    close(MemFile);
    return 0;


I got the registers values (set in defines) from the A20 User Manual but no PWM output even with this output given by the program:


------------------ Addresses ------------------
Control Register: 0xb6efee00
CH0 : 0xb6efee04
CH1 : 0xb6efee08
-----------------------  -----------------------
-------------------- Values --------------------
Control Register: 111
CH0 : 157221416
CH1 : 0
-----------------------  -----------------------
--------------- After CTRL Setup ---------------
Control Register: 12452220
Should be: 12452220
CH0 : 65538
CH1 : 131073
-----------------------  -----------------------


Can anyone find the problem? I'm stuck on it from 3 days ahah
Ill hook up an oscilloscope on thoose pins (CN8-> 21/19)to see if there is something that my logic analyzer doesn't get but i don't feel as lucky... I will try to access GPIO registers too, just to see if i can light up a led and confirm the mmap is working correctly.

Good luck for thoose who will try, Alessandro.
4
Hi guys, i'm looking forward to building  my own image for my cubietruck can someone point me in the right direction? I know i have to put kernel and rootfs somewhere in the nand or sd card but that's about it :/

Thanks for all the help found in this forum i'm sure this is the new and exciting way of learning ;)
5
Beginners / RTL2832 Drivers compiling
May 20, 2014, 05:22:25 pm
Hi guys,
i need to compile drivers for this device, gigabyte u7300, on this image[http://www.cubieforums.com/index.php?topic=1275.0] i've done a little research and i found this resouces:



I tried to compile them myself with guides on internet but i failed, the error says that there are file missing in the linux headers, which i can't download from the repos...

Any solutions? Anyone have succeded using this device? Thanks guys, i'll keep trying ;)
6
What about USB key? And just another one: can your image be uploaded directly through phoenix to the nand?  Will it be risky?

Thank you very much again for the help and the work you've done! :D
7
Hi guys,

as first thank you slovenia, i wanted to do this myself but with my knowledge it would have taken a life! I still does not understand the boot process of my cubietruck, what does it do when i power it on? What the boot sequence?

And again: if i put your image on the microSD while having lubuntu installed on the nand, from which one will it boot?

Don't bother correcting me if i'm wrong in something, i'm just a newbie  ;D
Alessandro, Italy!