Go to advanced search

by blippy
Wed Nov 17, 2021 12:37 pm
Forum: Raspberry Pi OS
Topic: Recommended C library for GPIO?
Replies: 1
Views: 89

Recommended C library for GPIO?

I'm aware of the existence of wiringPi and bcm2835 libraries. They require separate download and compilation, and seem to be deprecated. I heard that Linux now has GPIO and stuff built into the kernel. So what is the current recommended way of accessing GPIO? Hopefully one that doesn't require sudo ...
by blippy
Wed Nov 17, 2021 12:29 pm
Forum: Raspberry Pi OS
Topic: Website for package search?
Replies: 2
Views: 111

Website for package search?

The Debian has a website where I can search for packages. Is there an equivalent for Pi OS?
by blippy
Sat Oct 30, 2021 8:21 am
Forum: SDK
Topic: openocd LIBUSB_ERROR_ACCESS
Replies: 25
Views: 1397

Re: openocd LIBUSB_ERROR_ACCESS

Lenticularis wrote:
Fri Oct 29, 2021 4:34 pm
I have the same problem.
Did you already soveld it.
No. I still use sudo.
by blippy
Thu Oct 14, 2021 8:21 am
Forum: General
Topic: Interfacing with SSD1306 OLED displays via the C SDK
Replies: 25
Views: 5279

Re: Interfacing with SSD1306 OLED displays via the C SDK

Hi Guys, Thank you for the hard work on the OLED project. I have the example downloaded and have some scrolling raspberries! Looking at the methods in the code I don't see any way to write out with a standard character set. would you normally describe each character in a 2D array and call by refere...
by blippy
Sat Aug 28, 2021 7:57 am
Forum: SDK
Topic: static inlining fixed my fluttering problems
Replies: 6
Views: 467

Re: static inlining fixed my fluttering problems

The static/inline keywords convinced the compiler to inline the function. Indeed. It did. My knowledge of assembly is minimal, but I could see from the disassembly that this is what happened. not sure what fluttering means here There seemed to be a low-frequency toggling of the speaker that was per...
by blippy
Fri Aug 27, 2021 7:45 pm
Forum: SDK
Topic: static inlining fixed my fluttering problems
Replies: 6
Views: 467

static inlining fixed my fluttering problems

I was messing around with trying to produce a little music app. I used interrupts to time outputs. I found that it had some subtle, but annoying, "fluttering" in the output. I have short function called pi_alarm_rearm() which resets the interrupt. I found that by declaring it static inline...
by blippy
Wed Aug 25, 2021 6:14 pm
Forum: SDK
Topic: 8-bit PWM using DMA?
Replies: 2
Views: 386

Re: 8-bit PWM using DMA?

An additional note: sound is output on 2 channels rather than 1.
by blippy
Wed Aug 25, 2021 5:03 pm
Forum: SDK
Topic: 8-bit PWM using DMA?
Replies: 2
Views: 386

8-bit PWM using DMA?

This is a follow-on question to my previous post about using DMA to PWM. This time, suppose I want to work with just 8-bit data. Previously, I defined uint32_t table[NSAMPS]; but now I define it as uint8_t table[NSAMPS]; and I set up the values using: for(int i = 0; i< NSAMPS; i++) { table[i] = i; /...
by blippy
Tue Aug 24, 2021 8:30 pm
Forum: SDK
Topic: PWM using DMA
Replies: 2
Views: 347

Re: PWM using DMA

kilograham wrote:
Tue Aug 24, 2021 7:28 pm
at first glance

channel_config_set_dreq(&cfg, DREQ_PWM_WRAP0 + slice_num); // write data at pwm frequency

should be before the dma_configure.
I tried it, and it worked! I can't thank you enough! Your fix never would have occurred to me.
by blippy
Tue Aug 24, 2021 6:23 pm
Forum: SDK
Topic: PWM using DMA
Replies: 2
Views: 347

PWM using DMA

I decided if I could generate a sawtooth-like wave using PWM and DMA. Here's my code: #include <stdio.h> #include <string.h> //#define PARAM_ASSERTIONS_ENABLE_ALL 1 #include "pico/stdlib.h" #include <assert.h> #include "hardware/clocks.h" //#include "hardware/flash.h" #...
by blippy
Thu Aug 19, 2021 6:22 pm
Forum: Bare metal, Assembly language
Topic: Fast way to move memory?
Replies: 20
Views: 2391

Re: Fast way to move memory?

cleverca22 wrote:
Thu Aug 19, 2021 5:45 pm
why exactly do you need to move these large blocks of memory around?
It was for testing purposes.
by blippy
Thu Aug 19, 2021 1:57 pm
Forum: Bare metal, Assembly language
Topic: Fast way to move memory?
Replies: 20
Views: 2391

Re: Fast way to move memory?

So, I jiggered with my code to get some idea of speed. Transfer of 6 bytes using a naive memcpy took 5us. Using DMA took 3us. Transfer of 1MB took 349ms using memcpy, but only 12.8ms using DMA. That's a speedup of 27X. Seems quite impressive. However, there's been suggestions here of using word-alig...
by blippy
Thu Aug 19, 2021 12:31 pm
Forum: Bare metal, Assembly language
Topic: Fast way to move memory?
Replies: 20
Views: 2391

Re: Fast way to move memory?

OK, I think we have lift-off. The code below does memory-to-memory transfer, but I hadn't tried it with the framebuffer. I guess it would be good to do some kind of timing to see how long it takes. The code blocks until the transfer is complete. The BCM2835 doc says that the DMA base address is 0x7E...
by blippy
Tue Aug 17, 2021 11:37 am
Forum: Bare metal, Assembly language
Topic: Fast way to move memory?
Replies: 20
Views: 2391

Re: Fast way to move memory?

I have some non-working code: #include <gpio.h> #include <stdio.h> #include <timers.h> // DMA control block (must be 32-byte aligned) typedef struct __attribute__((packed)) { uint32_t ti, // Transfer info src, // Source address dest, // Destination address tfr_len, // Transfer length stride, // Tran...
by blippy
Mon Aug 16, 2021 9:10 pm
Forum: Bare metal, Assembly language
Topic: Fast way to move memory?
Replies: 20
Views: 2391

Re: Fast way to move memory?

Aligning to a word boundary and then coping words will over four times faster. In assembler doing four words at once will be even faster. I guess, but the speedup I saw a few years ago was way faster than that. I can only presume that there's something in VideoCore (??) that does memory operations ...
by blippy
Mon Aug 16, 2021 8:37 pm
Forum: Bare metal, Assembly language
Topic: Fast way to move memory?
Replies: 20
Views: 2391

Re: Fast way to move memory?

Show us your code. All of it?? Here's my version of memcpy(); void *memcpy(void *dest, const void *src, size_t n) { char *d = dest; while(n--) *d++ = *(char*)src++; return dest; } Here's my code relating to the framebuffer: #include <stdio.h> #include <string.h> #include <basal.h> #include <lfb.h> ...
by blippy
Mon Aug 16, 2021 7:57 pm
Forum: Bare metal, Assembly language
Topic: Fast way to move memory?
Replies: 20
Views: 2391

Re: Fast way to move memory?

Does that mean the copy is overlapped ? That makes it rather more difficult. In C you would have to use memmove instead of memcpy. That's probably not an issue, though, as the dest addr is lower than the src addr. In my tests so far, everything works. The real problem is speed. I'm pretty sure ther...
by blippy
Mon Aug 16, 2021 6:19 pm
Forum: Bare metal, Assembly language
Topic: Fast way to move memory?
Replies: 20
Views: 2391

Fast way to move memory?

I've been messing around with framebuffers in Pi0, bare metal. To scroll the buffer I use a hand-rolled version of memcpy. It is slow. I figure that there must be a way of performing a memcpy using hardware, but I can't find any resources. Can anyone give any pointers?
by blippy
Sat Aug 14, 2021 3:54 pm
Forum: Other RP2040 boards
Topic: Maker Pico SD card unreliable
Replies: 7
Views: 2313

Re: Maker Pico SD card unreliable

Hmmm, here's a thing ... I have been writing some test code on Linux. The thing about the failing card is that it had a Raspberry OS install. I couldn't find the partition table as I expected it. I think maybe that the card gets formatted to GPT rather than an MBR, so this is what might have been ca...
by blippy
Wed Aug 04, 2021 9:08 am
Forum: SDK
Topic: Issues with spi on pico as slave!
Replies: 4
Views: 1053

Re: Issues with spi on pico as slave!

Just a little followup ... I notice that this thread also discusses SPI master and slaves: https://www.raspberrypi.org/forums/viewtopic.php?f=145&t=300589 One point they raised is that in a multi-byte transfer, the Pico toggles the CS pin if you gpio_set_function(PIN_CS, GPIO_FUNC_SPI); Others h...
by blippy
Tue Aug 03, 2021 8:43 pm
Forum: SDK
Topic: Issues with spi on pico as slave!
Replies: 4
Views: 1053

Re: Issues with spi on pico as slave!

Hmmm, maybe not ideal, but I created a spi slave that sends data. It uses interrupts instead of a SPI peripheral, because, well, I haven't figured out how to do it. Some example code: #include <stdio.h> #include <string.h> #include "pico/stdlib.h" //#include "hardware/adc.h" //#i...
by blippy
Tue Aug 03, 2021 6:46 pm
Forum: SDK
Topic: Issues with spi on pico as slave!
Replies: 4
Views: 1053

Re: Issues with spi on pico as slave!

I'm trying to create a spi slave, too, but not having any luck. There is a mention of it at https://github.com/raspberrypi/pico-examples/issues/26 and https://github.com/raspberrypi/pico-examples/pull/101 but it doesn't to seem to either exist/work. It would be useful if one of the Pi Engineers coul...
by blippy
Thu Jul 22, 2021 3:21 pm
Forum: Other RP2040 boards
Topic: Maker Pico SD card unreliable
Replies: 7
Views: 2313

Re: Maker Pico SD card unreliable

matherp wrote:
Thu Jul 22, 2021 12:59 pm
The input I/O on the Pico seems inherently unreliable UNTIL you switch on hysteresis for ths pins used.
Oh. That's interesting. Thanks for the heads-up.
by blippy
Sat Jun 12, 2021 8:49 am
Forum: SDK
Topic: Using picoprobe/openocd as a stlink and serial?
Replies: 3
Views: 624

Using picoprobe/openocd as a stlink and serial?

The picoprobe can be used simultaneously as pico programmer and serial port. I'm wondering if the same can be done with an STM32 as a target. I tried the following: sudo openocd -f interface/picoprobe.cfg -f target/stm32f4x.cfg -s tcl but obtained the result: Open On-Chip Debugger 0.10.0+dev-geb22ac...
by blippy
Wed Jun 02, 2021 3:49 pm
Forum: SDK
Topic: repeating_timer_callback assertion failure
Replies: 6
Views: 572

Re: repeating_timer_callback assertion failure

I only turned on debugging because I was having problems. So I don't think that's the cause of my problems. As regards your second point, I'm afraid I don't understand the concepts involved. Perhaps you could elucidate. So XIP is the external flash memory, which is slow? And SRAM is memory on the ch...

Go to advanced search