Go to advanced search

by mark_3094
Sun Dec 22, 2013 8:10 am
Forum: Python
Topic: GPIO Event Handler
Replies: 2
Views: 3130

Re: GPIO Event Handler

I have partially figured this out (I can get polling to work without any problems). The problem was happening because the script ended. I added while True: time.sleep(10) Which seems to have solved the problem. To put my next comment in context, I am running RetroPie, with various console game emula...
by mark_3094
Sun Dec 22, 2013 7:32 am
Forum: Python
Topic: GPIO Event Handler
Replies: 2
Views: 3130

GPIO Event Handler

Hi, I am trying my first experiment with GPIO and python. I've connected a switch to GPIO 17 (with resistors, debounce cap, etc), and I'm getting it to send an F1 keypress when the button is pressed. This is because F1 is used to bring up a menu in an emulator I'm using. I have a script that uses in...
by mark_3094
Sun Nov 10, 2013 7:15 am
Forum: Bare metal, Assembly language
Topic: Interrupts and Exceptions
Replies: 14
Views: 3958

Re: Interrupts and Exceptions

After some testing, I think my interrupts are working. Copying the IVT back to 0x0 seems to have fixed the problem. I am unable to print to screen from my SWI handler, but I think this is a problem with my frame buffer code, as I can make the ACT light flash from the same function. Well, I'm off to ...
by mark_3094
Fri Nov 08, 2013 9:02 pm
Forum: Bare metal, Assembly language
Topic: Interrupts and Exceptions
Replies: 14
Views: 3958

Re: Interrupts and Exceptions

Next if you wish to use LDM/STM to copy your code you will want to use a empy stack type (LDMEA/STMEA) instead of the strange mix that you have there That's the assembler doing this. I just copied and pasted the code from this thread. the only change I made was to change to 0x9000: _reset: /* save ...
by mark_3094
Fri Nov 08, 2013 10:17 am
Forum: Bare metal, Assembly language
Topic: Interrupts and Exceptions
Replies: 14
Views: 3958

Re: Interrupts and Exceptions

Thanks for the ideas. I'm working through them now. This isn't going to do anything with regards to svc calls. I'm not even sure you *can* disable svc. If this is the case, I will ignore interrupts for now. I would like to get software interrupts working first, then move onto hardware interrupts. Th...
by mark_3094
Thu Nov 07, 2013 10:44 am
Forum: Bare metal, Assembly language
Topic: Interrupts and Exceptions
Replies: 14
Views: 3958

Interrupts and Exceptions

A while back I posted here about Interrupts and Exceptions, trying to get an understanding of how they work. I thought I had a good enough understanding, and recently I began trying to code this, however I'm having serious problems. Here is what I'm trying to do: 1. Setup the IVT 2. Setup handler fu...
by mark_3094
Fri Nov 01, 2013 11:03 am
Forum: Bare metal, Assembly language
Topic: SD/MMC and SPI
Replies: 10
Views: 9781

Re: SD/MMC and SPI

I'm getting a much better understanding of this now. I have a question about reading from the SD card. It looks like I have to follow this procedure: 1. Check that there is no transfer currently in progress 2. Send CMD17 to read a single block a. The argument is the block to read (assuming SDHC card...
by mark_3094
Wed Oct 30, 2013 10:37 am
Forum: Bare metal, Assembly language
Topic: problem with SPI
Replies: 8
Views: 2358

Re: problem with SPI

I haven't tried what you're doing (and I don't know much about it at all), but would DMA help?

I had a problem with performance when drawing to the screen (HDMI), and DMA was the solution.
by mark_3094
Tue Oct 29, 2013 8:49 pm
Forum: Bare metal, Assembly language
Topic: SD/MMC and SPI
Replies: 10
Views: 9781

Re: SD/MMC and SPI

I think we're getting pretty confused here with terminology.
Yes, this was the case. Thanks for clearing it up. I think I understand well enough to start designing my driver now.

Thanks again.
by mark_3094
Tue Oct 29, 2013 3:07 am
Forum: Bare metal, Assembly language
Topic: SD/MMC and SPI
Replies: 10
Views: 9781

Re: SD/MMC and SPI

I've just got a little more to add to this, in regard to sending commands to the SD card. I understand that the command packet is made up of 6 bytes; being the command code (8-bits), the argument (32-bits) and CRC (8-bits). Apparently the CRC can be left as zero on the RPi, as it doesn't do CRC chec...
by mark_3094
Mon Oct 28, 2013 10:06 pm
Forum: Bare metal, Assembly language
Topic: SD/MMC and SPI
Replies: 10
Views: 9781

Re: SD/MMC and SPI

Set CONTROL0 and CONTROL2 to 0 Set CONTROL1 to 0x01000000 (reset host controller circuit) Wait until that flag clears in CONTROL1 Or CONTROL1 with 0x000e0001 (C1_CLK_INTLEN and C1_TOUNIT_MAX ) Set clock frequency to 400Khz (disable the clock (turn off 0x00000004 in CONTROL1), OR the appropriate div...
by mark_3094
Mon Oct 28, 2013 6:29 am
Forum: Bare metal, Assembly language
Topic: SD/MMC and SPI
Replies: 10
Views: 9781

SD/MMC and SPI

Hi, I'm looking into supporting reads/writes from/to the SD card (the one that the RPi boots from, not a secondary external one). From some quick reading, it looks like SPI is the best way to do that, but unfortunately, I don't know a lot about either yet, and I'm trying to get a reasonable understa...
by mark_3094
Fri Sep 06, 2013 7:44 am
Forum: Bare metal, Assembly language
Topic: Switch to HDMI without config.txt
Replies: 1
Views: 946

Re: Switch to HDMI without config.txt

I'm not sure if I'm missing something, but I thought HDMI was default... The code I've written is similar to the tutorials on the Cambridge website (except I write in C), and I don't have any problems getting HDMI to work. The only option I have in my config.txt is the amount of memory the GPU gets ...
by mark_3094
Fri Sep 06, 2013 7:40 am
Forum: Bare metal, Assembly language
Topic: Interrupts
Replies: 12
Views: 9730

Re: Interrupts

Thanks. I think I have a better idea now. I didn't realise that some of these devices were Broadcom, not ARM, which had lead to some of my confusion. I haven't gotten around to planning how the system calls are implemented yet. I thought software interrupts may have been the way to go, but there may...
by mark_3094
Thu Sep 05, 2013 10:09 pm
Forum: Bare metal, Assembly language
Topic: Interrupts
Replies: 12
Views: 9730

Re: Interrupts

As far as x86 interrupts for message passing and applications are you think of the int 10h and int 21h and those kinds of x86 interrupts? Not to get too far off topic (this is a RPi forum after all), you're probably thinking of x86 BIOS interrupts. Once the x86 enters 'protected' mode (required to ...
by mark_3094
Thu Sep 05, 2013 10:04 am
Forum: Bare metal, Assembly language
Topic: Interrupts
Replies: 12
Views: 9730

Re: Interrupts

I've been digging into the BCM2835 manual, and I have found two tables of interrupts on page 113. I have two questions about this. 1. Why are these in two different tables? Is it because table 1 is for interrupts generated external to the CPU, and table 2 is internal interrupts? 2. It says not to im...
by mark_3094
Tue Sep 03, 2013 9:26 pm
Forum: Bare metal, Assembly language
Topic: Interrupts
Replies: 12
Views: 9730

Re: Interrupts

Sounds like there is a lot more than I realised. I was planning to create an 'empty' interrupt structure, which had a handler for each interrupt that just printed a message to the screen. I did this for x86, and just had a generic EOI (End of Interrupt) function to acknowledge that the interrupt had...
by mark_3094
Tue Sep 03, 2013 9:43 am
Forum: Bare metal, Assembly language
Topic: Interrupts
Replies: 12
Views: 9730

Interrupts

Hi, I've been thinking about interrupts, and how to implement them (just planning at this stage). I think I have my head around most of it, but there are some things I want to double check. When an interrupt is generated, does the handler function need to include some sort of system-state save/resto...
by mark_3094
Thu Aug 29, 2013 6:22 am
Forum: Bare metal, Assembly language
Topic: Interpreting Information from the Mailbox Interface
Replies: 0
Views: 651

Interpreting Information from the Mailbox Interface

I've recently written some code that uses the mailbox interface to query some details about the hardware. There are some results that I get back that I don't know how to interpret: Video Core Firmware = 0x55382 Board Model = 0x0 I got most of my information from https://github.com/raspberrypi/firmwa...
by mark_3094
Wed Aug 28, 2013 10:20 pm
Forum: Bare metal, Assembly language
Topic: 64 bit integers
Replies: 22
Views: 5129

Re: 64 bit integers

My solution is this: When passing a long long int to kprintf, kprintf will first retrieve a 32-bit value from va_list . It will then proceed to retrieve the 64-bit value, break it into two 32-bit values and print both of them. So far this seems to work. It will take some more testing to see if this ...
by mark_3094
Wed Aug 28, 2013 9:51 pm
Forum: Bare metal, Assembly language
Topic: 64 bit integers
Replies: 22
Views: 5129

Re: 64 bit integers

Also standard printf format syntax would require "%llX" rather than "%X" but that's probably not your issue Not the issue in this case, but thanks for pointing this out. I'm trying to implement an interface similar to printf, so I'll make sure I do this right in the end. One thing you might try wit...
by mark_3094
Wed Aug 28, 2013 9:42 am
Forum: Bare metal, Assembly language
Topic: 64 bit integers
Replies: 22
Views: 5129

Re: 64 bit integers

After fixing the error with the incorrect shift :oops: , I have been able to retry my testing. It's now at a point where I can pass 64bit values to my test function, which breaks the value into two 32-bit functions, and prints them separately. The only problem now is that it's not working with varia...
by mark_3094
Wed Aug 28, 2013 5:17 am
Forum: Bare metal, Assembly language
Topic: 64 bit integers
Replies: 22
Views: 5129

Re: 64 bit integers

Shouldn't that be temp = (value >> 32); Yes, you're right. This would be a typo during testing, but I did try another time using the correct shift, and it still didn't work. Thanks for pointing that out though. This means that some of the more recent testing that I did would have yielded false resu...
by mark_3094
Tue Aug 27, 2013 12:20 pm
Forum: Bare metal, Assembly language
Topic: 64 bit integers
Replies: 22
Views: 5129

Re: 64 bit integers

So, if I understand right, this is happening: 1. the debug function stores the 64-bit value in r0 and r1 2. debug calls test 3. test stores r0 and r1 into memory (the frame pointer) at - 28 and - 24 4. r3 is set to zero, and is stored at fp -16 5. r1 is set to zero ( ldr r1, [fp, #-16] ) 6. kprintf ...
by mark_3094
Tue Aug 27, 2013 10:56 am
Forum: Bare metal, Assembly language
Topic: 64 bit integers
Replies: 22
Views: 5129

Re: 64 bit integers

Thanks for sticking with me so far. Debugging at this level is definitely not one of my strong points. I did try using your code, but the compiler didn't like it. So what I did next was try to write my own function that uses a 64-bit value: int test (unsigned long long int value) { int temp; temp = ...

Go to advanced search