Go to advanced search

by wxs
Tue Feb 11, 2020 4:21 pm
Forum: Bare metal, Assembly language
Topic: How to do a "if(low level detect)" of RPi4 in bare metal
Replies: 4
Views: 501

Re: How to do a "if(low level detect)" of RPi4 in bare metal

00400000 is a decimal (base 10) number where you wanted the hexadecimal (base 16) number 0x00400000. You need to prefix a number with 0x if you are writing it in hexadecimal. Thanks for pointing out that error. BTW, I found the problem (a little bit funny): I was trying to see the level change on g...
by wxs
Tue Feb 11, 2020 2:32 pm
Forum: Bare metal, Assembly language
Topic: How to do a "if(low level detect)" of RPi4 in bare metal
Replies: 4
Views: 501

Re: How to do a "if(low level detect)" of RPi4 in bare metal

I don't know about the rest of the code but your bit test is long (2 instructions where only 1 is needed) and the value you use is in the wrong base (hexadecimal numbers need the base specifying). Also line comments begin with an @ unless the source is pre-parsed with cpp. You can remove the cmp in...
by wxs
Tue Feb 11, 2020 9:19 am
Forum: Bare metal, Assembly language
Topic: How to do a "if(low level detect)" of RPi4 in bare metal
Replies: 4
Views: 501

How to do a "if(low level detect)" of RPi4 in bare metal

Hi, I wanna start output something only when a low level is detected on gpio22. The pseudo code is like: Set pull up on GPIO22 while (GPIO22 is high){} do something and here is my code (doesn't work): ldr r0,=0xFE2000E4 /*set the GPPUPPDN0 address*/ mov r1,#1 lsl r1,#12 str r1,[r0,#4] /*set pull up ...
by wxs
Tue Feb 11, 2020 8:21 am
Forum: Bare metal, Assembly language
Topic: How to set RPi4 (bcm2711) GPIO pull up/down
Replies: 7
Views: 1417

Re: How to set RPi4 (bcm2711) GPIO pull up/down

As I understand it, there are two bits per GPIO pin allocating 16 pins per register, 'xx' being set to 00, 01 or 10, none, pull-up or pull-down respectively ... Yaaaaay, I guess that's it. I've already tested it. But same as before 10 for pull up. (I don't know how to test a pull down because both ...
by wxs
Mon Feb 10, 2020 3:56 pm
Forum: Bare metal, Assembly language
Topic: How to set RPi4 (bcm2711) GPIO pull up/down
Replies: 7
Views: 1417

How to set RPi4 (bcm2711) GPIO pull up/down

Hi, I found a script online shows the way to do it in C /* 2711 has a different mechanism for pin pull-up/down/enable */ #define GPPUPPDN0 57 /* Pin pull-up/down for pins 15:0 */ #define GPPUPPDN1 58 /* Pin pull-up/down for pins 31:16 */ #define GPPUPPDN2 59 /* Pin pull-up/down for pins 47:32 */ #de...
by wxs
Fri Feb 07, 2020 1:50 pm
Forum: Bare metal, Assembly language
Topic: Is it possible to implement a GPIO pin as PWM serializer mode
Replies: 2
Views: 453

Re: Is it possible to implement a GPIO pin as PWM serializer mode

aBUGSworstnightmare wrote: maybe this helps https://github.com/keybuk/SignalBox/wik ... DCC-signal
Thanks for the link. But I think that's exactly what I did. I can use the PWM to generate the signal but I need one more output that works similarly.
by wxs
Fri Feb 07, 2020 12:30 pm
Forum: Bare metal, Assembly language
Topic: Is it possible to implement a GPIO pin as PWM serializer mode
Replies: 2
Views: 453

Is it possible to implement a GPIO pin as PWM serializer mode

Hi, My goal is to bitbang a sequence over 10MHz. After I tried many ways, I finally find the best is to use the PWM serializer mode , and here's the code .section .init .globl _start _start: ldr r0,=0xFE200000 mov r1,#1 lsl r1,#14 str r1,[r0] /*set gpio 4 as func0 gpclk*/ ldr r0,=0xFE101070 ldr r1,=...
by wxs
Wed Feb 05, 2020 2:50 pm
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

Re: how to generate clean GPIO signal at high frequecy

I heard an explanation that sounds reasonable: The shadow is kind of an energy reflection as there's no termination resistor (load). Maybe the internal pull up/down resistor is not enough for such high frequencies. I'll try connecting an external resistor and see how it goes
by wxs
Wed Feb 05, 2020 1:58 pm
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

Re: how to generate clean GPIO signal at high frequecy

I suspect it will look much better if you wind the trigger level down by a volt or so. Set it in the middle of the range between low and high. Then let's see what you have. Hello again, Heater. As I said before, I didn't set the trigger level for some rules or reasons, I just go through negative to...
by wxs
Wed Feb 05, 2020 1:47 pm
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

Re: how to generate clean GPIO signal at high frequecy

joan wrote: If all you want to do is send a single short message I'd have a look at the capabilities of the PCM and PWM peripherals. They would handle the timing in hardware.
Thanks joan, I tried PWM with serializer mode and it looks like the best way I can do now.
pwm_single.png
pwm_single.png (45.13 KiB) Viewed 581 times
pwm.png
pwm.png (51.63 KiB) Viewed 581 times
by wxs
Tue Feb 04, 2020 10:27 am
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

Re: how to generate clean GPIO signal at high frequecy

Are you continually sending new messages (i.e. different data) at 10 Mbps or so? I can't see a way to do that with the Pi's hardware (unless PCM/I2S has this capability). I don't see a way of doing this in software either. We have other device to convert the signal source to continuous bit streams....
by wxs
Tue Feb 04, 2020 10:07 am
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

Re: how to generate clean GPIO signal at high frequecy

Now, if your signal goes down after a brief time you will have a spike in the middle of your screen. As you blue trace shows. After that, if other spikes happen at random times they will appear at random position on the screen. Because the timing of these spikes is random(ish) their positions are r...
by wxs
Tue Feb 04, 2020 9:40 am
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

Re: how to generate clean GPIO signal at high frequecy

Your scope should be showing the 15 MHz clock much squarer. I conclude that you are not using x10 probes. Such probes come with the scope for a reason. Please use them to look at the clock and the GPIO. Or you have the 20 MHz bandwidth limit enabled on both scope channels. If so, turn it off. Hi, d...
by wxs
Mon Feb 03, 2020 4:45 pm
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

Re: how to generate clean GPIO signal at high frequecy

The question then is why is the timing so erratic? Are you really running this bare-metal with no Linux or other OS underneath it? What interrupts do you have going on at the same time? Have you disabled any clock scaling? First, thanks for your interest. I'm not sure what you mean by 'erratic timi...
by wxs
Mon Feb 03, 2020 4:35 pm
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

Re: how to generate clean GPIO signal at high frequecy

You are triggering the trace on channel 2 and the trigger level is set within the range of most of your continuous signal. Which seems to span 2 volts if I'm reading the display correctly. As such the trigger is locked onto your main signal which is therefor displayed solid and clear. The interesti...
by wxs
Mon Feb 03, 2020 3:57 pm
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

Re: how to generate clean GPIO signal at high frequecy

joan wrote: We would need to understand the specific patterns you want to transmit.
I wanna generate the following signals at 10-50MHz, say 15MHz
data to send.png
data to send.png (28.86 KiB) Viewed 1759 times
with some timing restriction like
datatiming.png
datatiming.png (38.23 KiB) Viewed 1759 times
But before I work on the synchronization, I have to generate some nice GPIO signals
by wxs
Mon Feb 03, 2020 3:31 pm
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

Re: how to generate clean GPIO signal at high frequecy

What is the underlying question? What are you trying to achieve? I'm trying to bitbang GPIO signals with specific patterns at about 10-50MHz, but looks like high frequency GPIO output has some problems, I'm not sure if it's because of my code or algorithm or hardware itself. Why aren't you using Pi...
by wxs
Mon Feb 03, 2020 2:44 pm
Forum: General discussion
Topic: how to generate clean GPIO signal at high frequecy
Replies: 31
Views: 2428

how to generate clean GPIO signal at high frequecy

Hi, I actually posted a similar topic here https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=261318&p=1591433#p1591433 But looks like it raised a discussion on other things. Let me rephrase my question again: I'm generating some GPIO signal above 10MHz, using the following bare metal c...
by wxs
Fri Jan 31, 2020 8:56 am
Forum: Bare metal, Assembly language
Topic: GNU toolchain: No such file or directory
Replies: 5
Views: 1375

Re: GNU toolchain: No such file or directory

Thanks for the resources. I have one last question: Is my bare metal process correct? I first install the Raspbian(The raspbian installer did the partition things), after I got Raspbian I remove all the .img files and copy my own .img (compiled from C or assembly) to it. And whether my RPi is runnin...
by wxs
Thu Jan 30, 2020 4:06 pm
Forum: Bare metal, Assembly language
Topic: GNU toolchain: No such file or directory
Replies: 5
Views: 1375

Re: GNU toolchain: No such file or directory

None of his makefiles or code will work because you GCC version fails 2 and 3. As you want to run the 64 bit linux libraries and your Pi4 GCC will be setup for that just make a main.c file and start coding. There is nothing from the baremetal tutorials you did that is applicable. Thanks for pointin...
by wxs
Thu Jan 30, 2020 1:46 pm
Forum: Bare metal, Assembly language
Topic: GNU toolchain: No such file or directory
Replies: 5
Views: 1375

GNU toolchain: No such file or directory

Hi, I'm following https://github.com/BrianSidebotham/arm-tutorial-rpi/tree/master/part-1 this tutorial and I've already compiled some codes using arm-none-eabi-gcc on Windows and run on RPi 4. And now my C code has some linux libraries and I tried to redo the tutorial on Raspbian on RPi4. When I dow...
by wxs
Thu Jan 23, 2020 1:44 pm
Forum: Bare metal, Assembly language
Topic: How to turn on the MMU of RPi 4
Replies: 4
Views: 968

How to turn on the MMU of RPi 4

Hi,
can anyone post a link or tutorial on how to turn on the MMU of RPi 4? I tried to google it but didn't find anything useful.
Thanks
by wxs
Mon Jan 20, 2020 11:06 am
Forum: Bare metal, Assembly language
Topic: How to compile more compliciated C code to bare metal img
Replies: 3
Views: 1001

How to compile more compliciated C code to bare metal img

Hi, I'm playing with the GPIO stuff in bare metal. I can compile some easy C code to img and boot on RPi, like the following: #define GPIO_BASE 0xFE200000UL volatile unsigned int* gpio; int main(void) { gpio = (unsigned int*)GPIO_BASE; gpio[1] |= (1 << 18 | 1 << 21); gpio[2] |= (1 << 0 | 1 << 3); wh...
by wxs
Fri Jan 17, 2020 1:52 pm
Forum: General discussion
Topic: difference between GPCLK and toggling a GPIO output
Replies: 0
Views: 150

difference between GPCLK and toggling a GPIO output

Hi, I have a device which can only be setup with an external clock over 10MHz. I can now set the GPIO pins and the GPCLK pin by adjusting the register values (from the GPIO base address 0xFE000000). An interesting observation is that my device can only be setup with the signal from the GPCLK, but no...
by wxs
Tue Jan 14, 2020 9:23 am
Forum: Bare metal, Assembly language
Topic: Raspberry Pi 4 | Technical Reference Manual
Replies: 4
Views: 982

Re: Raspberry Pi 4 | Technical Reference Manual

The peripheral base is 0xFE000000, and others should be the same relation to the base as before, I just tested the GPIO and the GPIO base is 0xFE200000

Go to advanced search