Search found 2758 matches

by Roberthh
Sun Feb 14, 2016 11:37 am
Forum: General Discussion and Questions
Topic: Supplying Arguments to viper function
Replies: 18
Views: 7674

Re: Supplying Arguments to viper function

I found it. It's no bug, just a feature: changing the code makes is much slower. The first variant had about 500 ns between the first and second write, and 450 ns for the following ones. The second variant had like 14 µs between the first and second pulse, and 540 ns within the loop. addressof() see...
by Roberthh
Sun Feb 14, 2016 10:30 am
Forum: General Discussion and Questions
Topic: Supplying Arguments to viper function
Replies: 18
Views: 7674

Re: Supplying Arguments to viper function

Hello Pythoncoder, thanks for the hints. I tried to integrate that fpr my code, but something is strange. I have a piece of code that works: import pyb, stm from uctypes import addressof @micropython.viper def tft_cmd_data(self, cmd: int, data: ptr8, size: int): gpioa = ptr8(stm.GPIOA + stm.GPIO_ODR...
by Roberthh
Sun Feb 14, 2016 7:55 am
Forum: General Discussion and Questions
Topic: Supplying Arguments to viper function
Replies: 18
Views: 7674

Re: Supplying Arguments to viper function

Hello Damien, thanks for the feedback. I was not sure, and I could not find it written somewhere. I tried it and it seems to work. About your question: For practical purposes it does not matter whether it's possible to specify a pointer as R/O or R/W. The latter works in all circumstances, and you c...
by Roberthh
Sat Feb 13, 2016 8:59 pm
Forum: General Discussion and Questions
Topic: Supplying Arguments to viper function
Replies: 18
Views: 7674

Supplying Arguments to viper function

Hello all, is there a method for supplying a bytes data object to a viper function, such that it is seen as a pointer type object. I see how I can declare an int arg, and viper also does not refuse something like arg: ptr8, but call it results in an error: "can't convert bytes to int" @micropython.v...
by Roberthh
Thu Feb 11, 2016 8:15 pm
Forum: General Discussion and Questions
Topic: Optimising Python speed tutorial
Replies: 7
Views: 4514

Re: Optimising Python speed tutorial

Hello @pythoncoder, that is really a good text, and it is a big support for everyone trying to code "at the bus". And I am definitely the wrong person for see typos. Maybe Damien or someone else from the core team could have a look at it, if something would have to be amended, especially about langu...
by Roberthh
Tue Feb 09, 2016 10:49 am
Forum: General Discussion and Questions
Topic: Pin Toggle Frequency Contest against C. Please Help! :)
Replies: 41
Views: 22572

Re: Pin Toggle Frequency Contest against C. Please Help! :)

@chuckbook: Thanks. That's what I understood from your previous post about the strh instructions. What I was wondering about is, that he unconditional branch takes 2 cycles, opposed to the conditional which seems to take 4 cycles. That looks like accessing the flags adds another timing penatly. It d...
by Roberthh
Mon Feb 08, 2016 4:03 pm
Forum: General Discussion and Questions
Topic: Pin Toggle Frequency Contest against C. Please Help! :)
Replies: 41
Views: 22572

Re: Pin Toggle Frequency Contest against C. Please Help! :)

I have a piece of code that works, submitted to the other forum under a different nickname. import pyb, stm @micropython.viper def toggleViper(cnt: int): bsrr = ptr16(stm.GPIOA + stm.GPIO_BSRRL) while cnt: bsrr[0] = 1 bsrr[1] = 1 cnt -= 1 @micropython.asm_thumb def toggleASM(r0): # r0 has loop count...
by Roberthh
Thu Feb 04, 2016 12:26 pm
Forum: General Discussion and Questions
Topic: Pin Toggle Frequency Contest against C. Please Help! :)
Replies: 41
Views: 22572

Re: Pin Toggle Frequency Contest against C. Please Help! :)

Thanks. I'm very exited about this discussion, because it gives very helpful information for two applications of PyBoard, where I thought it would be too slow. But the viper mode and direct addressing of peripheral registers is just the right combination of speed and code readability.
by Roberthh
Thu Feb 04, 2016 7:26 am
Forum: General Discussion and Questions
Topic: Pin Toggle Frequency Contest against C. Please Help! :)
Replies: 41
Views: 22572

Re: Pin Toggle Frequency Contest against C. Please Help! :)

With a slightly changed loopPerformance3d() the results are a little bit better, using Port A0. I get Counted: 3,565,062 (viper4) (time=561ms) which would be 7.130.124 toggles. For comparison, I made a single endless loop toggling X1 (Port A0). The loop period is 82 ns or 12 MHz, the shortest time b...
by Roberthh
Wed Feb 03, 2016 9:00 pm
Forum: General Discussion and Questions
Topic: Pin Toggle Frequency Contest against C. Please Help! :)
Replies: 41
Views: 22572

Re: Pin Toggle Frequency Contest against C. Please Help! :)

Hello Folks, since this is all very interesting, I did a test. I took the function togglePerformance3D and hooked up an oscilloscope to red LED: It shows a period of 298 ns and a frequency of 3,356 MHz. The output of the script is:. Counted: 6,700,168 (viper4) (time=597ms) where the time and the 2 m...