Difference between revisions of "Sysblocks Getting Started Guide"

From Flowcode Help
Jump to navigationJump to search
 
Line 453: Line 453:
 
                                                               '''Audio effects system'''
 
                                                               '''Audio effects system'''
 
                                           This program is a microcontroller based audio effects generator .
 
                                           This program is a microcontroller based audio effects generator .
 
== '''Curriculum: Music with microcontrollers course''' ==
 
 
 
[[File:SysblocksGSG49.png|left]][[File:SysblocksGSG50.png|right]]
 
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
 
'''Description'''
 
 
The Music Technology pack uses a single Sysblock and Flowcode Embedded to allow students to quickly construct a wide variety of digital music applications and understand the principles of digital music manipulation for musical effects and manipulation. Students will gain an appreciation of D/A conversion and A/D conversion and Digital Signal Processing Techniques that allow music to be sampled, delayed, manipulated and produced in the digital domain. Students make use of signal generators, microphones and speakers/headphones to create and understand a variety of applications in Music Technology. The pack is suitable for students 16+ with an interest in embedded programming and Music.
 
 
'''Learning objectives'''
 
* Analogue to Digital Conversion
 
* Digital to Analogue conversion
 
* Simple Digital Signal Processing
 
* Nyquist
 
* Audio effects including echo, reverb, distortion
 
* Mixers
 
* Sampling and music creation
 
* Delays and stadium balancing
 
* EQ and filters
 
 
== '''Curriculum: Systems, signals, DSP, FFT''' ==
 
 
 
[[File:SysblocksGSG51.png|left]][[File:SysblocksGSG52.png|right]]
 
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
 
'''Description'''
 
 
The Systems, signals, DSP and FFT pack introduces students to a number concepts in digital systems including A/D and D/A conversion, Nyquist, Digital Signal Processing, signal manipulation, Fourier analysis of signals and the FFT algorithm, and Digital Filters. Students perform a range of experiments that teach them about the details of signal manipulation using a single Sysblock and pre- written programs created in Flowcode embedded. Students download the programs and carry out a number of experiments that teach them about the parameters and techniques of Signal processing. There is also plenty of chance for creative programming using Flowcode embedded for the advanced students who will find that the Sysblocks and Flowcode combination provide the perfect platform for the rapid creation of signal manipulation systems.
 
 
'''Learning objectives'''
 
*Analogue to Digital Conversion
 
*Digital to Analogue conversion
 
*Nyquist
 
*Digital Signal Processing techniques
 
*Digital Signal manipulation
 
*Convolution and level detection
 
*Fourier analysis
 
*FFT systems
 
*Digital filters
 
 
== '''Curriculum: Communications and Software Defined Radio''' ==
 
 
[[File:SysblocksGSG53.png|left]][[File:SysblocksGSG54.png|right]]
 
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
 
'''Description'''
 
 
Once students have been through the Systems, signals, DSP and FFT pack they can move onto the Communications and Software Defined Radio course. This course allows students to construct and experiment on a wide range of systems based on Sysblocks. Students use a panel with three Sysblocks on to create a sequence of communications modulators and encoders, add noise, and then demodulate / decode the resulting signals. In doing so students understand the parameters of communications systems including Phase Locked Loop performance, signal to noise ratios, bit error rates and the principles of software defined radio. The communications systems students investigate include AM, FM, PLLs, QPSK, XPSK, APSK, FSK, and OOK. Students can also examine spread spectrum systems and correlation. Students work with pre-written programs for Sysblocks. There is also plenty of chance for creative programming using Flowcode for the advanced students who will find that the Sysblocks panel and Flowcode combination provide the perfect platform for experimentation with digital comms. The hardware platform includes 3 x Sysblocks panels (encode/modulate, decode/demodulate, and noise generator) and a mixer board.
 
 
Learning objectives
 
 
*AM and FM
 
*Digital communications systems
 
*Modulation / Demodulation
 
*Encoders / Decoders
 
*Phase Locked Loops
 
*PRBS and Bit Error Rates
 
*AM, FM, QPSK, XPSK, APSK, FSK, and OOK
 
*Software Defined Radio
 
*Spread spectrum techniques
 
 
== '''Results''' ==
 
 
[[File:SysblocksGSG55.png]]      [[File:SysblocksGSG56.png]]      [[File:SysblocksGSG57.png]]
 
        '''AM modulated waveform'''                                '''FFT of AM signal'''           
 
                                                                                          '''ASK implemented for the sequence 0010 1111 1001 0101 (blue) with synch signal (red)'''
 
 
              [[File:SysblocksGSG58.png]]                      [[File:SysblocksGSG59.png]]   
 
    ''''Constellation plots show how data is'''            '''Eye diagrams can be used to show the ''' 
 
                '''encoded in PSK systems'''                      '''quality of digital transmissions'''
 
 
 
==''' Product codes '''==
 
 
[[File:SysblocksGSG5.png|left]]
 
BL8386 standard experimentation panel with power supply and USB lead in standard tray.<br>
 
Sysblocks board is protected with a clear acrylic cover. E-blocks II compatible.
 
[[File:SysblocksGSG6.png|left]]
 
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
 
BL9296 Communications panel including 3 x Sysblocks boards, mixer board, set of 6 micro BNC leads, USB lead and power supply in a standard tray.<br>
 
Sysblocks boards are protected with a clear acrylic covers. E-blocks II compatible.
 
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
 
<pre>
 
BL2461  Sysblocks PCB only                                      BL0129  E-blocks II Grove sensors board       
 
BL9731 Sysblocks mixer PCB only                                BL0154 E-blocks II SD card board
 
CP1210 Music with microcontrollers curriculum                  BL0173 E-blocks II Terminal board
 
CP2398 Systems, signals, DSP, FFT curriculum                  BL0162  E-blocks II Servo motor board
 
CP6125 Communications and Software Defined Radio              BL0152R  E-blocks II Zigbee router board
 
BL8386 Standard Sysblocks experimentation system              BL0152C  E-blocks II Zigbee coordinator board
 
(Music with microcontrollers or DSP)                            BL0183 E-blocks II Relay board
 
BL9296 Sysblocks Communications experimentation system        BL0157 E-blocks II Colour graphical display board
 
BL6374 BNC splitter                                            BL0170 E-blocks II Bluetooth board
 
BL4585 BNC to SMA adaptor                                      BL0136 E-blocks II Wifi board
 
BL6889 SMA to SMA lead 250mm                                  BL0106 E-blocks II Mikroe adaptor board
 
BL0167 E-blocks II LED board                                  BL0187 E-blocks II Ethernet board
 
BL0145 E-blocks II Switch board                                BL0169 E-blocks II Mono graphical LCD board
 
BL0117 E-blocks II Prototype board                            BL0140  E-blocks II CAN bus board
 
BL0169 E-blocks II Mono LCD board                              BL0197 E-blocks II RFID board
 
BL0138 E-blocks II Keypad board                                BL0131 E-blocks II GSM board
 
BL0127 E-blocks II Actuators board</pre>
 
 
=='''Schematics'''==
 
 
[[File:SysblocksGSG60.png|centre]]<br><br> [[File:SysblocksGSG61.png|centre]]<br><br>[[File:SysblocksGSG62.png|centre]]<br><br> [[File:SysblocksGSG63.png|centre]]<br><br>[[File:SysblocksGSG64.png|centre]]<br><br> [[File:SysblocksGSG65.png|centre]]<br><br>[[File:SysblocksGSG66.png|centre]]
 

Latest revision as of 09:17, 11 December 2023

SysblocksGSG1.png

Introduction to Sysblocks

SysblocksGSG2.png

Sysblocks and Flowcode 10 provide a new way of teaching about signal processing for Music technology, DSP, Communications and Software Defined Radio.

Hardware:

The opportunity of developing a product like Sysblocks is facilitated by the advent of advent of low cost high speed, high power microcontrollers - in this case a 32bit PICmicro microcontroller. The Sysblock hardware topology is very simple: Input buffer …..A/D….processor...D/A….output amplifer.

Sysblocks boards also include two E-blocks II boards so that students can use a wide variety of expansion boards from Matrix, Grove, Mikroelektronika and others.

Software:

Flowcode 10 software is a graphical programming solution for microcontrollers and PCs. Flowcode allows those with limited programming experience to develop complex electronic systems using graphical and conventional C code programming.

Curriculum: There are three separate curricula for Sysblocks and Flowcode 10:

  • Music with microcontrollers
  • Systems, signals, DSP, and FFT
  • Communications and Software Defined Radio

The following information will explain to you how Sysblocks and Flowcode 10 can be used to provide fantastic learning opportunities in electronics.

Hardware: PCB overview

SysblocksGSG3.png
1. Fast 32 bit PIC processor                                    16. Input switch SW2 

2. PIC18F24K50 control processor that handles                   17. E-blocks II expansion port A  
   the USB communications, 32 bit PIC programming,                    
   LCD display, encoders and input switches                     18. E-blocks II expansion port B 

3. SMA connector  Input IN0                                     19. USB socket / power in 

4. AC / DC coupling switch SW4                                  20. 2.1mm power jack, 5 - 12V 

5. SMA connector  Input IN1                                     21. Screw terminal power connector (input or output)

6. AC / DC coupling switch SW3                                  22. 2 x banks of 8 user programmable  LEDs - for VU meters 

7. SMA connector Output OUT0                                    23. Grove sensor expansion socket 

8. SMA connector  Output OUT1 

9. 3.5mm jack stereo line in 

10. 3.5mm jack stereo line out 

11. 4 line monochrome LCD display 

12. Rotary encoder input ENC0 

13. Rotary encoder input ENC1 

14. Input switch SW0 

15. Input switch SW1 

Hardware: block diagram

SysblocksGSG4.png

Sysblocks has four analogue inputs, two analogue outputs and support circuitry.

At the heart of the system is a very powerful 32 bit Micro chip PICmicro microcontroller running at 200MHz. This is capable of standard microcontroller type functions and also is capable of Digital Signal Processing the incoming audio signals. The 32 bit processor has a Coremark of 652 (around 330 Drystone MIPS) which is more than fast enough for the signal processing tasks involved for learning about Music technology, Digital Signal Processing and Modern communications theory.

The 32 bit PICmicro microcontroller is programmed by a host device which is a standard 18 series PICmicro microcontroller. This host device takes care of non-core tasks like USB communications, LCD display, encoder and switch inputs. This architecture keeps the main 32bit device free for signal processing.

Two E-blocks ports are made available for expansion. E-block boards for Wifi, keypad, Bluetooth, CAN, Zigbee and many other functions are available. This gives huge flexibility to the Sysblocks system as a wide range of projects can be built around it. A Grove connector is also available which allows users to access the wide range of Grove accessories.

The analogue input signals are buffered and level shifted to half of the supply voltage – 1.65V – and then fed to the internal A to D converters of the main 32 bit PICmicro microcontroller. A digital potentiometer allows the level of the input signals to be adjusted in software.

The microcontroller processes the digital signals and feeds the results to 2 x external R2R ladder DACs which are buffered by operational amplifier circuits. Line out left and right include a digital potentiometer that allows the output level to be adjusted in software.

The board is fitted with a number of switches and encoders for control purposes. The board also has a miniature monochrome graphical display and a number of programmable LEDs including 2 x 8 LED VU meter LEDs.

The board is powered from 3.3V from USB or from a plug top power supply.

· Vin max      2.2V pk to pk 
· Vout max     2.2V pk to pk 

Hardware: Sysblocks products

SysblocksGSG5.png

BL8386 is our standard Sysblocks< experimentation panel.

It consists of a single Sysblocks board on a plastic panel with power supply and USB lead and is shipped in a standard tray for storage.

The Sysblocks board is protected with a clear acrylic cover to make it more rugged in the lab.

Students use conventional oscilloscopes and spectrum analysers to examine the results of
signal processing in a music and DSP context.






















SysblocksGSG6.png

BL9296 is our Sysblocks Communications panel. This includes 3 x Sysblocks boards and a signal mixer board on a plastic panel. This configuration allows students to experiment with lots of different types of communications and examine their characteristics.

The first Sysblocsk board is used to modulate and / or encode a signal into a digital format. The second Sysblocks board is used to generate noise. The encoded/modulated signal and noise are mixed together in the mixer board and fed into the third Sysblocks board. Where the signal is then demodulated/decoded and fed to the outputs. Separate programs are used in each Sysblock. This configuration allows students to experiment with multiple modulating/demodulating and encoding/deconding systems and examine their noise characteristics.

The Sysbocks Communications panel is supplied with a set of 6 micro BNC leads, USB lead and power supply in a standard tray. Sysblocks boards are protected with clear acrylic covers. Students use conventional oscilloscopes and spectrum analysers to examine the signals in the system.














Software: Flowcode

SysblocksGSG7.png
SysblocksGSG8.png




Flowcode 10 Electronic system design software includes Data flow / DSP components which you can see on the right. This programming paradigm allows students to build a wide variety of signal processing systems using conventional graphics that are used in text books and papers to describe the behaviour of signal processing systems.

To build a system students simply select the DSP / Data flow operator they want from the component library and drag it onto the panel. They then select the component’s properties and connect the relevant inputs to the outputs of other icons to create a functioning system. They then connect inputs and outputs to the real world – A/D and D/A. Students can combine these data flow programs with flow charts, C code, pseudocode and state machine diagrams to produce highly functional electronic systems based on microcontrollers and Windows computers.

Once the system is constructed students can use the internal simulation engine to see the results of the programusing the internal logic analyser and oscilloscope tools.

Once they are happy with their program they can compile it to the powerful Sysblock 32 bit PIC in just a few seconds. They can then use conventional oscilloscopes, spectrum analysers and other instruments to see their program working.

The images that follow demonstrate the kind of systems that can be developed with Flowcode 10.






























Your first Sysblocks program

1 Create a new project Choose a target for a new project. You can find the SysBlocks by the path 32-bit PIC->Misc->SysBlocks.

SysblocksGSG9.png





















2 Add the Sysblocks control panel to the 2D panel

One of the potential difficulties with the Sysblocks architecture is that there are two processors on the board that handle different tasks. Flowcode takes care of this through a hardware component that allows access to the switches, display, and encoders. A single component allows easy access to all of them for the user.

SysblocksGSG10.png




From Component Libraries->Hardware->E2Blocks->SysBlocks. SysblocksGSG11.png






3 Develop your program

Use a component macro to initialise the Sysblocks component. Create a loop - while 1 - and Use Sysblocks LED component macro, and a couple of 100ms delays, to flash LED 1 on and off.

SysblocksGSG12.png


4 Simulate your program

Select DEBUG...RUN to simulate the program

SysblocksGSG13.png


5 Program the Sysblocks board

SysblocksGSG14.png

Congratulations! You have built your first Sysblocks program. LED 0 should be flashing at 1 second intervals.


6 Create a Data flow program

For a Data flow program you need to add at least one Input ADC and one Output Port from the Components Libraries. You can find the Input ADC and Output Port in the DSP section of Flowcode which is under the Components Libraries. You need to drag them to the 2D Panel.

SysblocksGSG15.png
SysblocksGSG16.png
SysblocksGSG17.png











After dragging them to the 2D Panel, you need to connect the components DSP_PortOut and DSP_AdcIn together by setting up the properties of DSP_PortOut. The properties would be shown in the right if you click the component DSP_PortOut in 2D Panel. Click the triangle of the Ref1::LinkTo to connect the component DSP_PortOut to the component DSP_AdcIn. If they are connected, you will see a line between them. Select Autoscale for DSP_PortOut to YES. The sampling is 12 bit but the output is 16 bit and Autosclale takes care of that. Of course this is a very simple program - we take an input, sample it at 3kHz to create a digital data stream, we pass that to an output DAC and recreate the signal. Its not a very useful program, but it gets the system up and running and you can then add other data processing icons to develop a more complex system.



7 Connect the input port

SysblocksGSG18.png

You need to set up the input in the hardware of the Sysblocks board by right clicking the DSP_AdcIn in 2D and selecting Properties. Under CONNECTIONS … CHANNEL select the input port you want. We have selected AN0 which is the Micro BNC IN0.





























8 Connect the output port

You need to set up the mapped Port in the hardware of the Sysblocks by click the PortSelection in the properties of DSP_PortOut. The two output ports of the Sysblocks board could be Port J (OUT0) and Port H (OUT1) , which you can check with the User Drawing at the Appendix of this document. Just choose one mapped port for the Output. Also, you need to set the AutoScale as Yes in the Properties of DSP_PortOut to make sure the output data does not overflow.

SysblocksGSG19.pngSysblocksGSG20.png

9 Setting up the interrupt

Add an Interrupt icon to the start of your program. Double click to set the properties. Select Timer 1 to call a new macro: Data-flow.
Click on CREATE NEW MACRO to create the new Data-flow macro SysblocksGSG21.png

Set the Properties of the interrupt so that the interrupt frequency is 3051Hz.SysblocksGSG22.png

This is now the ‘Tick’ frequency for your Data flow program.SysblocksGSG23.png







< 10 Your Data flow program Add the AddSample and WritePort to the Data_flow macro. Every time there is an interrupt these routines in the Data flow program will be executed. You can now send the program to the board as in step 5. Note that you still have your Main flow chart program executing: so LED0 is flashing at regular intervals at the same time as the Data Flow program is running.

SysblocksGSG24.png


11 Evaluating the first program

SysblocksGSG25.png

For this section you will need a signal source and a two channel oscilloscope like a Picoscope. The Pico scope has a waveform generator that you can use as a signal source. You will need a splitter so that you can feed this into channel A of the scope and IN0 on the Sysblocks board. Set switch SW4 to AC You can connect OUT0 to channel B of the oscilloscope. Set the waveform generator to produce a sinewave at a frequency of 100Hz. Your Data flow program will sample this at 3kHz and will send the sampled waveform to the output. You should see this on your oscilloscope:

SysblocksGSG26.png































What you can see here is that the Sysblocks board has sampled the input (blue) and reflected it on the output (red). Now that you have the basic system up and running you are ready to start to manipulate signals.


















The Sysblocks Flowcode component

SysblocksGSG27.png

Sysblocks has two processors - the main 32 bit PIC processor that executes the program and a secondary 18 series PIC that takes care of USB communications and the LCD. This architecture allows the 32bit PIC freedom to focus on number crunching and not I/O tasks. The potential downside of this architecture is that using the LCD could be complex. The complexity is taken care of for you by the Sysblocks component. This includes all of the hardware routines that you need to control the board

SysblocksGSG28.png


Initialise ()

Must be called at the start of any Sysblocks program to initialise the hardware functions

LCDClear() 

Clears the LCD display

LCDWriteString() 

Allows you to write a message to the LCD. Max 20 characters per row.

X      BYTE    Starting column for the text.

Y      BYTE    Row to write text on (0..3)

Data	<-STRING	The string to write.

ReadEncoderCounter() 

Read one of the two encoders on the board.

Channel	BYTE	Encoder to read. 0=ENC0, 1=ENC1

RETURN	INT	The current value of the encoder<\pre> 

ReadSwitch()

Read one of the three switches on the board.

Channel	BYTE	Switch to read. 0=SW0, 1=SW1, 2=SW2

RETURN	 BOOL	The state of the switch.

ReadSwitches()

Read all three switches at once.

RETURN	 BYTE	States of all switches. Bit0=SW0, Bit1=SW1, Bit2=SW2

ResetEncoderCounter()

Make the current one of the encoder counters zero.

Channel	BYTE	Encoder to reset. 0=ENC0, 1=ENC1

SetDigitalPotWiper()

Set the position of one of the digital potentiometers on the board. When the board powers up, all the potentiometers are set to the mid-way position. For most 
applications, it is not necessary to alter them.

Channel	BYTE	The channel to set: -

0 Line in left gain.

1 Line in right gain

2 IN 0 gain

3 IN 1 gain

4 Line out left level

5 Line out right level

Value	UINT	The wiper setting from 0 to 128.

USBGetByte()

Returns the next available byte from the USB virtual com port. This provides a way for an application running on a PC to send data to the SysBlocks firmware.

RETURN	UINT	The byte read from the stream.

USBGetNumberBytes()

Returns the number of bytes available in the stream from the USB host.

RETURN	UINT	Number of bytes available.

USBLookForValue()

Peek into the stream from the USB host to look for a specific value or sequence of values. This can be used to respond to commands that are marked by delimitiers.

Value		<- STRING	String containing the character or sequence to search for.

NumChars		BYTE		The number of characters in the sequence.

RemoveContent	        BYTE		0 = Just search, leave the stream unaltered.

					1 = Remove bytes up to and including the search term.

ResetFind		BYTE		0 = If removing bytes, then remember if the first part of the 
					
                                        sequence has been found.

					1 = Ignore partial sequences and start again.

RETURN		        BYTE		0 = Not found

					1 = Found
USBSendString()

Send a string to the USB host.

Data	STRING	The string to send.

WriteLEDs

Set the states of all three of the LEDs that are to the right of the LCD.

Values	 BYTE	A binary number where the first three bits represent the states of the three LEDs.

WriteVU()

Set the state of one of the banks of eight LEDs at the upper left corner of the board.

Channel	BYTE	The channel, 0 or 1.

Value	BYTE	Eight-bit binary number to be shown by the LEDs. Bit 0 is the lowest LED and bit 7 is the topmost.

WriteVUBargraph()

Channel	BYTE	The channel, 0 or 1.

Value	BYTE	The number of LEDs to be lit.

DSP icons

SysblocksGSG29.png

At the time of going to press the image on the right shows the DSP icons currently available.

These are documented in the Flowcode wiki which can be found within the components section of the Wiki You can use these icons by dragging them onto the 2D panel and connecting them together. Connections are made between the icons using the properties panel of each icon. When connected you will see an appropriate Data flow line between icons.

SysblocksGSG30.png













































Connection tables

SysblocksGSG31.png
SysblocksGSG32.png

Software: Examples of signal processing with Flowcode

SysblocksGSG33.png  SysblocksGSG34.png  
                         Delay                                                                Echo

SysblocksGSG35.png  SysblocksGSG36.png
                        Filter                                                    Phase Locked Loop

SysblocksGSG37.png  SysblocksGSG38.png
                      QPSK modulation                                                   Multiplex

SysblocksGSG39.pngSysblocksGSG40.png
                          Data flow program                                                                           Flowcode control panel


                                                               Signal generator with noise
This program allows students to create a signal and noise generator that uses the Sysblocks rotary encoders to select the type of base signal, the amplitude and the 
frequency of the signal.
SysblocksGSG41.pngSysblocksGSG42.png
                          Data flow program                                                                           Flowcode control panel
  
                                                          AM demodulator
This program is a digital AM demodulator with four types of demodulation: envelope, phase, multiplier, unsynchronised multiplier. 
Students make the choice of which demodulation system is used by making selections with an encoder input and the LCD display.
SysblocksGSG43.png
                                                                 Data flow program

SysblocksGSG44.png
                                                                                Flowcode control panel
 
                                                           Graphic equaliser
This program is a graphic equaliser which works by splitting the audio signal into separate bands then recombining them at the levels dictated by the sliders.

SysblocksGSG45.pngSysblocksGSG46.png
                           Data flow program                                             Flowcode control panel

 
                                                        xPSK decoder demodulator
                         This program uses switches to select which xPSK decoding scheme to choose and which baud rate.


SysblocksGSG47.png
                                                                 Data flow program

SysblocksGSG48.png
                                                                                Flowcode control panel


                                                              Audio effects system
                                          This program is a microcontroller based audio effects generator .