Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 17:44 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Intercepting signals via PICOMITE

     Page 2 of 3    
Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5091
Posted: 12:08pm 18 Sep 2022
Copy link to clipboard 
Print this post

  Tinine said  Biting my tongue....well, keyboard fingers

SMH

Craig


P2?

Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 02:52pm 18 Sep 2022
Copy link to clipboard 
Print this post

ESP32 clone at a tiny fraction of the price. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 299
Posted: 03:23pm 18 Sep 2022
Copy link to clipboard 
Print this post

Mixtel90,

  Quote  slave SPI has to see the clock edges in hardware


Sure.

  Quote  A slave I2C device can pause the transfer by stretching the clock, but that can't happen under SPI as it has no control over the clock whatsoever.


Of course.

  Quote  IMHO you *can* have a slave SPI on a PicoMite, but it will have to run slowly as the clock edges can only be detected using software interrupts


This is!
I am not talking about software SPI. Of course it must be hardware SPI in slave mode following hosts clock!

Does rp2040 has no hardware SPI capable run in slave (following hosts clock) mode ?? And does it means SPI in MMbasic is also software based?
My MMBasic 'sand box'
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 299
Posted: 03:43pm 18 Sep 2022
Copy link to clipboard 
Print this post

Volhout,

sorry I don`t get it what Craig wanted to say, nor your following comment P2?

I understood Mixtels90 joke about dried frogs pills, and googled out what had in mind once Geoff saying "pr2040 is a dog". But "Biting my tongue....well, keyboard fingers" only googled something about epilepsy :D
My MMBasic 'sand box'
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 04:55pm 18 Sep 2022
Copy link to clipboard 
Print this post

The RP2040 hardware SPI modules can run in both master and slave modes, but an interpreted language like MMBasic simply isn't fast enough to keep up with incoming data. If you were using the SPI modules natively you could grab the data on hardware interrupts using DMA. You don't have long - the buffer is only eight 16-bit values. That's not practical in MMBasic. The interrupts are software driven and there's no DMA.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 05:37pm 18 Sep 2022
Copy link to clipboard 
Print this post

  electricat said  Volhout,

sorry I don`t get it what Craig wanted to say, nor your following comment P2?

I understood Mixtels90 joke about dried frogs pills, and googled out what had in mind once Geoff saying "pr2040 is a dog". But "Biting my tongue....well, keyboard fingers" only googled something about epilepsy :D


"Biting my tongue": When one has something to say but they realise that it won't be well received, one bites their tongue. But there is no speech involved here, only typing which I use my fingers for.  

I tend to be irritating here when I bring up the Parallax Propeller. It was designed specifically to address the issues that are a constant challenge.

To paraphrase Charles Petzold "Programming for Windows" (or something like that):

"The best way to use interrupts is not to"

Propeller P1 and P2 have 8 processors with shared memory. Program them using FlexBasic and it's no more difficult than programming with MMBasic.

The P2 has 64 identical "smart pins" that are mini processors in their own right and are capable of a multitude of functions.

Mind blowing stuff and the perfect companion to the PicoMite.

Craig
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 06:37pm 18 Sep 2022
Copy link to clipboard 
Print this post

I just got three ESP32 D1 Mini modules for £2.76 each. How much was the P1 again? Not to mention the P2? ;)

I've been playing with Annex32, you'll be pleased to know. I'm a raw beginner. Mind you, I'm fitting it in between obligatory DIY sessions. I haven't got time to really get started yet.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 06:47pm 18 Sep 2022
Copy link to clipboard 
Print this post

It is worth understanding how SPI works so we can put this to bed. Everytime you initiate a set of clocks on the master the slave response to each clock pulse by putting a bit out on MISO. Normally a SPI master will issue a command to which the slave just puts "0" on the bus for each bit and then when the master sends the next set of clock pulses the slave is expected to have its data ready to immediately put on the bus.

To implement a SPI slave in MMBasic you would trigger an interrupt on receiving the command and Basic would then need to set a defined variable with the response before the second set of clock pulses from the master. In other words the slave pretty much has to know the response as soon as it sees anything from the master. This makes responding to a set of "commands" where different responses are selected impossible to do in a Basic interrupt in a timely fashion.
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 299
Posted: 07:11pm 18 Sep 2022
Copy link to clipboard 
Print this post

Well, Mixtel90, Craig I think I am done now.

I can always read datasheet, write CSUB if I need it badly (but I know Microchip diamonds are my best friends ) and stop biting my tongue?

Craig, P2 seems to be interesting toy :) I`ve heard of them before, but never stopped by somehow.
My MMBasic 'sand box'
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 07:18pm 18 Sep 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  I just got three ESP32 D1 Mini modules for £2.76 each. How much was the P1 again? Not to mention the P2? ;)

I've been playing with Annex32, you'll be pleased to know. I'm a raw beginner. Mind you, I'm fitting it in between obligatory DIY sessions. I haven't got time to really get started yet.


How many processors do you get?
Do you have compiled Basic?
You just got done with "no DMA"

DMA on the Prop is "DIM shared"
Read as fast as you want on one processor and all processors have the data.

You are shackled with limitations with everything that's not Prop.

Just perusing a brochure about OMRON's new motion controller. They purchased a high-end motion specialist Delta-Tau. Their boast:

"World's fastest motion controller can close 5 Servo loops in 50uS"

I have their spec sitting in front of me right now. Hmmm, I have 12 Servo loops running in 20uS and that's one processor, running at base speed.

I have even padded the loop with redundant math.

This thing is insane. I'm just thankful that it isn't mainstream  
Edited 2022-09-19 05:19 by Tinine
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 299
Posted: 07:53pm 18 Sep 2022
Copy link to clipboard 
Print this post

matherp,

Seems, I did not took into account how large interrupt routine there might be already in MMbasic interpreter servicing different things. I was damn stupid to think hardware SPI is implemented already, so there should be possibility implement host`s CLK driven CS independent SPI too.

Anyway, it might be not so useful for most users anyway. I had specific case, solved with dedicated chip and that`s it. Case closed
My MMBasic 'sand box'
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 07:58pm 18 Sep 2022
Copy link to clipboard 
Print this post

Processors: As many as I need, non that I don't so none wasted.
If I needed compiled BASIC I'd use GCBASIC on a PIC.
I don't need DMA on a PicoMite. Why should I need it on the ESP32?
Not multi-processor like a prop, but two cores.
Far more interested in built-in wi-fi and bluetooth than speed and number of processors.
And at that price if I blow one up I'm not going to cry about it.

If I'm "rich" sometime I'll play with a P1, I promise. However things being what they are at present I'm not going to try to guess when. The P2 is out - it's simply too expensive a beast to have hanging around as a plaything - no matter how good it is.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 08:08pm 18 Sep 2022
Copy link to clipboard 
Print this post

@electricat
I considered doing software SPI, writing routines for master and slave in MMBaasic rather than using the hardware SPI modules. The clock is then much slower and more predictable. However, the data transfer rate would be pretty bad! For my application I'd only be shifting a few bytes at once though so it *might* be feasible to do it. Controlling a CS line would cause an interrupt on the slave so give a synchronising point for the clock detection.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 08:24pm 18 Sep 2022
Copy link to clipboard 
Print this post

@Mixtel90

So per the thread title, you have no solution...got it  



Craig
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 09:24pm 18 Sep 2022
Copy link to clipboard 
Print this post

No problem - neither do you. :)
It's been educational about what SPI can and can't do though, so it's not been a loss.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 09:48pm 18 Sep 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  No problem - neither do you. :)
It's been educational about what SPI can and can't do though, so it's not been a loss.


5 mins of FlexBasic on the "old" P1. It's geared for real-time.

 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 06:23am 19 Sep 2022
Copy link to clipboard 
Print this post

So the P1 with FlexBasic would do it?

It's not cheap, though :(

Where are they manufactured? Need to take likely future availability into account...

John
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 07:35am 19 Sep 2022
Copy link to clipboard 
Print this post

Only made by Parallax in the US. No other manufacturer. No UK support office, but available from the larger component distributors. HobbyTronics have the P1 bare chip for £10.80 inc. VAT.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 11:43am 19 Sep 2022
Copy link to clipboard 
Print this post

Is there an open-source PIC32?  
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 12:16pm 19 Sep 2022
Copy link to clipboard 
Print this post

  JohnS said  So the P1 with FlexBasic would do it?

It's not cheap, though :(

Where are they manufactured? Need to take likely future availability into account...

John


In my case it's peanuts. A single P1 can easily out-perform four of what is commonly used:




I used to have six of these on a board to handle six axes. Even the old P1 is capable of double the motor command resolution (13bit vs 12bit) and there are still plenty of cogs to spare.

Another cog might be handling 4 full-duplex UARTs @115KBaud.
Another cog might be handling VGA.


Ten quid is nothing when you consider the on-board capabilities.

Craig
 
     Page 2 of 3    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025