Can this be done with RISC OS on a rpi3 ?
Pages: 1 2
Eduard Hontele (5213) 18 posts |
Good morning, First, I want to introduce myself. I am Eduard Hontele living in Belgium. I am familiar with C/C++ programming in linux and microcontrollers. I never used RISC OS. I want to use RISK OS on a raspberry pi3 for building a fifo. Input to the fifo comes through a RJ45 cable directly connected to a powerfull computer. The rpi3 buffers the stream and sends it via the gpio interface to a couple of hardware fifo buffers. The buffers are clocked with a 4 MHz signal and this 12 bit parallel signal is outputed to a digital-analog converter. This is working fine with the rpi3 and lubuntu. Writing to the DAC at a stable 4 MHz clock speed is essential. I wonder if it would be possible to simplify the DAC circuit board by using the RISC OS instead of linux. Perhaps forum members can tell me if it is possible to do this with RISC OS. Please can You give me some advice: The ultimate goal is a radio amateur project. I am using the rpi3 as a microcontroller. No keyboard, neither a screen. The rpi3 is just running this single task. Sincerely, Eduard Hontele |
David Feugey (2125) 2687 posts |
2: GCC and DDE
https://www.riscosopen.org/forum/forums/11/topics/3801 ???
Should be.
And RISC OS kernel is single task, so with very predictable timings. |
Glen Walker (2585) 469 posts |
Hello and Welcome! I am not the most experienced user here and there are a few knocking around with brains the size of a planet who will doubtless be able to tell you straight away if what you want to do is possible. I will say that there is a port of GCC—just look for GCCSDK. Also you should possibly consider the DDE available from the store here. It is the original C compiler for RISC OS and it comes with useful debugging tools. If you are not going to be using the desktop then you should probably look at RISC OS Pico too! Its available in the downloads section… Other than that I can’t say much more than welcome and hope you enjoy using the OS! :—) edit: looks like David can type faster than me! |
David Feugey (2125) 2687 posts |
IMHO, it’s too old. Just stick to RISC OS 5.24 and – if needed – use a few tricks to boot directly in your single tasking software. edit: or was online before you :) |
Eduard Hontele (5213) 18 posts |
Hello David, hello Glenn, Thank You for the quick answer. It seems that the job can be done using the RISC OS. First of all I have to familiarize myself with the os. Reading the book “RISC OS system programming revealed” from the author Bruce Smith gives me the impression that RISC is a better start for using the rpi as a microcontroller. Indeed, I don’t need multitasking neither graphics for building a large fifo memory. Sincerely, Eduard |
Tristan M. (2946) 1036 posts |
If I recall there are a few Bruce Smith books to do with RISC OS. His writing style doesn’t match my learning style but I have purchased all his books as I find them a useful reference along with the RISC OS PRMs and and the other online documentation on the RISC OS Open website. Oh, here we go. The RO related books by Bruce Smith are: The things to be wary of is a lot of the content of these books use the assembler built into the BASIC interpreter. ObjASM which is a part of the DDE toolchain uses similar syntax, as does asasm which is part of the RISC OS version of the GCC toolchain. However it is not the assembler which GCC uses to build C source. It uses …the name escapes me sorry. The GCC assembler and it’s associated syntax instead. |
Eduard Hontele (5213) 18 posts |
Thank You Tristan, I have the “RISC OS system programming revealed book”. There is no number on the first page. Likely it is part 1. Yes indeed, the number of C straight and cross compilers( and assemblers too) is a bit confusing for a beginner. Yesterday I installed the RISC OS for the first time on a raspberry pi. Installing the gcc4 compiler with !Packman was no problem. Tomorrow I want to find out why “gcc -v” gave the insufficient memory error. There is a Youtube video mentioning this problem. With a bit of luck I will write “hello world!” tomorrow. Is it a good idea to go on with the gcc compiler ? Perhaps the C compiler available in the store may be better or easier? An important question I forgot in my first mail: "is it possible to make a self written program autostarting at boot ? Have a nice day, Eduard |
Stephan Kleinert (2271) 67 posts |
most likely, you need to increase the available memory for the compiler (left-click on the RISC OS icon in the icon bar, then increase “next” to a couple of MB. 640K is too little for gcc) |
David Pitt (3386) 1248 posts |
A bit more than that, gcc 4.7.4 requires 16MB to start. |
Tristan M. (2946) 1036 posts |
In the task window, or ShellCli you can type wimpslot -next 32768Kor whatever value to achieve the same effect as dragging the slider, but without the frustration of getting it right. I usually use 32MB for GCC for arbitrary reasons :) If you are running gcc from the current task window, you might need to drop the “-next” to allocate more to the current window. I think. It’s late. Not hard to test though. |
Steffen Huber (91) 1945 posts |
Yes. (At least) two options:
Have fun with RISC OS! |
Eduard Hontele (5213) 18 posts |
Hello, Indeed, I have fun with RISC OS. On Youtube I found a tutorial from James Hobson. After a day “hello world” is printed on screen by means of gcc. Next step is to test the essential parts of my linux gcc program. Before porting the whole program to RISC OS I want to see UDP communication and gpio working. I am anxious to see if my rpi can handle the udp functions used in linux. Sincerely, Eduard |
John Sandgrounder (1650) 574 posts |
That post is a bit old. There is a more up-to-date post with an answer somewhere. But I have not found it yet. |
Eduard Hontele (5213) 18 posts |
Thank You John, Yesterday I tried to compile a first UDP test program. Not very useful but nice to feel the behavior of RISC OS gcc. It is native code for linux. A pc sends a datagram to the rpi. The rpi answers with the same string in uppercase. The udp send and receive functions are exactly the same as in linux. This example uses blocking read.The program written for linux works without change. One of these days I’ll try the nonblocking read. Even compiling a bigger program I wrote for linux gave no error at compilation time. Running the program didn’t succeed. I got an error message: “Wimpslot not big enough to run ELF program”. In linux this program is running well. I wonder what is going wrong. Have a nice day, Eduard |
Matthew Phillips (473) 687 posts |
The absolute limit on the Wimpslot in RISC OS 5 is currently 512MiB. I’m not very sure about ELF executables, as I thought that recent versions of RISC OS 5 can work out the size of Wimpslot required from the executable. You could try running the program from an Obey file, and setting the Wimpslot manually to something big: WimpSlot -Min 150000K -Max 150000K |
Eduard Hontele (5213) 18 posts |
Good morning Matthew, As You see, RISC OS is a new world for me. Increasing the “Next” in the .. window worked fine. Now its time to read some pages to solve the next problem: gpio. Obviously the method used in my linux program will fail. As far as I know there is no “/dev/mem” in RISC OS. Opening like I have done in linux will fail. I found a link to this: https://www.riscosopen.org/forum/forums/11/topics/6426 Next step will be trying to understand what people have been done to master gpio. Sincerely, Eduard |
Eduard Hontele (5213) 18 posts |
Hello everyone, In the Bruce Smith book “Raspberry Pi Risc OS …” there is an example on gpio. I ported this code to gcc. Then I made a small loop that toggles gpio21. I watched the waveform on an oscilloscope. Very high speed; about 40 MHz on a rpi2 ! Do you know what is going on ? Is there a way to handle this problem? Omitting the 4K hardware buffer between the rpi and the DAC would be nice but I am not so sure that it will be possible. Sincerely, Eduard |
Colin (478) 2433 posts |
The pi uses fast interrupts for USB – not sure if OS_IntOff disables fast interrupts. |
Dave Higton (1515) 3404 posts |
In that case, a hardware-based solution is essential. No software on an RPi3 can possibly meet those time constraints. You need to look at the real frequency at which the input signals come in (whatever value you are told is only an approximation), and how you are going to relate the output frequency (to the DAC) to the input frequency. Also, do the input data ever pause? If so, what are you going to do to the DAC? I would be looking to use an FPGA for the job. |
Eduard Hontele (5213) 18 posts |
Hello Colin, Hello Dave, I think you are right. The rpi is terrible fast but perhaps, the last stage has to be hardware. No doubt that hardware can handle the job. I made a circuit around a rpi3 running linux. Between the rpi3 and the DAC there are two 72V05L15J circuits. Together they make a 4K x 12 fifo. The 4 MHz clock is the rpi 500 MHz clock divided by 125 taken from gpio 4. This circuit is doing the job very well. The input to the rpi3 is controlled by handshake. If the rpi buffer becomes almost full, the computer who generates the stream has to wait a few moments. The mean reason why I am not that happy with the actual fifo buffer between the rpi and the DAC is the number of traces Sincerely, Eduard |
Dave Higton (1515) 3404 posts |
I hope you’re familiar with transmission lines. Logic is so fast these days that even a short PCB trace has to be considered as a transmission line. Undershoot and overshoot can affect the output of a DAC. Make sure you have terminated all the logic traces. Since you’re probably dealing with all point-to-point connections, series termination should do – but be careful to avoid crosstalk into the clock trace. If you’re familiar with the maths of transmission lines, all this stuff should be easy and obvious. (If you think a DAC is difficult, an ADC may be much more so!) |
Eduard Hontele (5213) 18 posts |
Hello Dave, Yes, being a retired electronics engineer, I have studied RF and microwave systems. I know there are a lot of things that can’t be done at home. I want to keep the DIY circuits stupid simple. If it was possible to eliminate two integrated circuits by using RISC OS instead of linux the circuit would simplify. Choosing a high speed component will introduce high speed problems. Good evening, Eduard |
Dave Higton (1515) 3404 posts |
Me too! |
Eduard Hontele (5213) 18 posts |
Hello Dave, Engineers don’t give up that easy! Today I changed the contents of 4 interrupt registers. (7E00B20C, 7E00B21C, 7E00B220, 7E00B224) This way I could disable all the fast and the normal interrupts. After disabling every interrupt the test program is toggling gpio21 at 40 MHz continuously. That looks very nice on the oscilloscope. I have another test program. The pc sends a large udp datagram to the rpi. The rpi answers with one char. After receiving the answer the pc sends next datagram to the rpi and so on. The pc can print something on screen to monitor if the rpi is still alive. Tomorrow I will test this as I did a week ago. First I will switch off the fast interrupt. After that I will switch off groups of normal interrupts. I will see what is going to happen. Because I use only a small part of the RISC OS there is a chance that I can turn off most interrupts. Screen, mouse and keyboard will stop working but they are not used in this program. Have a nice day, Eduard |
Neil Fazakerley (464) 124 posts |
Eduard, 40MHz sounds very impressive, especially if noise free. |
Pages: 1 2