Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:46 26 Nov 2024 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 : SPI for alternate purpose

Author Message
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 858
Posted: 08:28am 18 Mar 2024
Copy link to clipboard 
Print this post

Didn't want to pollute the LED matrix thread but it never dawned on me to use the SPI TX for zapping-out a stream of pulses that doesn't tie-up Basic. Any good examples of usage out there?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6786
Posted: 09:34am 18 Mar 2024
Copy link to clipboard 
Print this post

A PIO is better. They are basically separate processors and run independently of the main CPUs, at their own clock speed. They are also accessible from MMBasic. If you use SPI you are tied to the specialised SPI commands.
Mick

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

Joined: 05/03/2018
Location: Netherlands
Posts: 4228
Posted: 09:42am 18 Mar 2024
Copy link to clipboard 
Print this post

Hi Phenix,

The SPI is not actually running in the background. The SPI WRITE command blocks any other MMBasic execution until the SPI transfer is done. But the command is more efficient than shifting out data in MMBasic.

The PIO can work independent of the ARM (and thus MMBasic) but you need to feed it with data to shift out. And that must come from MMbasic. IF however you pack the data in a buffer, PIO can work with that buffer completely independent. So MMBasic only once fills that buffer at each change, and from there MMBasic is free to do whatever it wants. The buffer can be circular, or linear.

In case of the matrix sign the SPI sends out data consuming 20% of the MMBasic CPU time. Leaving you with 80% CPU time for the rest of the program. And... you should not use other interrupts, since it will impact the display of text.

If you would use the PIO, you would end up with 100% CPU time for MMBasic, and have the ability to run interrupts in you MMBasic code. But it is harder to design, and uses more code.

Regards,

Volhout
Edited 2024-03-18 19:45 by Volhout
PicomiteVGA PETSCII ROBOTS
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 858
Posted: 10:26am 18 Mar 2024
Copy link to clipboard 
Print this post

Ah, but more of my focus is on the 100pin ARMmite H7...no PIO  
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6786
Posted: 10:37am 18 Mar 2024
Copy link to clipboard 
Print this post

Dedicate a Pico to the job. Feed the Pico commands via a COM port as that's buffered and it can grab them as needed.  :)
Mick

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

Joined: 07/11/2023
Location: United Kingdom
Posts: 858
Posted: 10:47am 18 Mar 2024
Copy link to clipboard 
Print this post

  Mixtel90 said  Dedicate a Pico to the job. Feed the Pico commands via a COM port as that's buffered and it can grab them as needed.  :)


Yeah, good point. Was already considering a Pico for a sidekick  
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024