ECIO and use of USB in Flowcode
-
- Posts: 209
- Joined: Thu Oct 19, 2006 11:46 am
- Location: Bakewell, UK
- Has thanked: 20 times
- Been thanked: 16 times
ECIO and use of USB in Flowcode
ECIO and use of USB in Flowcode
The ECIO devices are very appealing if we can use the USB to send data back to a PC.
Is this possible?
Is it possible in Flow Code?
If not directly possible is there a work around (via RS232)? Pure USB is not in any case what I suspect many people want, rather a simulated COM port for interfacing via the .NET framework serial port feature.
Self evidently, if a 232USB e-block is required it defeats the whole benefit (for my purposes) of ECIO.
Thanks
The ECIO devices are very appealing if we can use the USB to send data back to a PC.
Is this possible?
Is it possible in Flow Code?
If not directly possible is there a work around (via RS232)? Pure USB is not in any case what I suspect many people want, rather a simulated COM port for interfacing via the .NET framework serial port feature.
Self evidently, if a 232USB e-block is required it defeats the whole benefit (for my purposes) of ECIO.
Thanks
Go with the Flow.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO and use of USB in Flowcode
Hi Mark
This functionality is on the way. There is currently a HID USB example available from the beta components download section.
http://www.matrixmultimedia.com/Flowcode_Components.php
This functionality is on the way. There is currently a HID USB example available from the beta components download section.
http://www.matrixmultimedia.com/Flowcode_Components.php
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: ECIO and use of USB in Flowcode
Hi all,
What is the flowcode HID USB example use for ? If i download it in the PIC ,how can i use it ? which connection i need ?
MIKE
What is the flowcode HID USB example use for ? If i download it in the PIC ,how can i use it ? which connection i need ?
MIKE
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO and use of USB in Flowcode
Hello Mike
If you download the program onto an ECIO then you should see the mouse pointer on your PC moving in a figure 8. You will need to give the software a few seconds to leave the ECIO bootloader mode and register the USB parameters.
If you download the program onto an ECIO then you should see the mouse pointer on your PC moving in a figure 8. You will need to give the software a few seconds to leave the ECIO bootloader mode and register the USB parameters.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: ECIO and use of USB in Flowcode
Hi,
I'm trying to create an USB application based on the USB_Mouse example provided in the beta components. After adding the usb_defs.h file to the correct directory I'm able to generate a hex file, however looking at the generated c code I noticed the following lines:
//Start USB interrupts
//Interrupt : Enable USBINT
//failed to generate code for interrupt
It seems something is going wrong, I haven't got a clue at to what I'm doing wrong so I'm hoping you can help me out.
Another issue, I'm trying to get the code to run on the PICDEM FS USB Demo Board which has a different processor. When I set the chip to 18F4550 Flowcode complains about being unable to run one ore more commands in the flowchart. The offending command is 'Enable USBINT'. Am I trying the impossible or doing something wrong? (Hmm, just tried switching to the 18F2455, the device on the ECIO board. Results in the same error)
Best regards,
Jac
I'm trying to create an USB application based on the USB_Mouse example provided in the beta components. After adding the usb_defs.h file to the correct directory I'm able to generate a hex file, however looking at the generated c code I noticed the following lines:
//Start USB interrupts
//Interrupt : Enable USBINT
//failed to generate code for interrupt
It seems something is going wrong, I haven't got a clue at to what I'm doing wrong so I'm hoping you can help me out.
Another issue, I'm trying to get the code to run on the PICDEM FS USB Demo Board which has a different processor. When I set the chip to 18F4550 Flowcode complains about being unable to run one ore more commands in the flowchart. The offending command is 'Enable USBINT'. Am I trying the impossible or doing something wrong? (Hmm, just tried switching to the 18F2455, the device on the ECIO board. Results in the same error)
Best regards,
Jac
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: ECIO and use of USB in Flowcode
Hi again!
Solved the issues listed in my previous message. According to the beta components page:
This solved the problem with switching to the 18F4550 as well.
Regards,
Jac
Solved the issues listed in my previous message. According to the beta components page:
It seems the V3.4.7.48 release has the same problem. Looking at the fcd files included in this release there is no USBINT. Used the zip provided at the beta components page to replace the files and now the generated C code looks fine.Note: The ECIO definition files that come with Flowcode V3.2.2 do not include the USB interrupt function. Therefore if you are using V3.2.2 or earlier of Flowcode you will need to replace the ECIO FCD files with the later ones. The FCD files are located in the Flowcode V3/FCD directory.
This solved the problem with switching to the 18F4550 as well.
Regards,
Jac
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: ECIO and use of USB in Flowcode
Yes - the addition of the USB interrupt came after the v3.4.7 release and there have not been any new releases since. The latest FCD files for the ECIO and USB devices are attached to this post.
- Attachments
-
- PIC USB FCD files.zip
- (18.25 KiB) Downloaded 685 times
Re: ECIO and use of USB in Flowcode
Hi all.
Anyone who knows how to use, USBINT in USBSerial for create one interrup when you receive something?
I've been doing a program to send data, and receiving by interruptions, but continuously the interruption jumps.
In the datasheet of 18f2550 don´t appears anything about usb interrupts in read serial port.
Thanks, good programming.
Anyone who knows how to use, USBINT in USBSerial for create one interrup when you receive something?

I've been doing a program to send data, and receiving by interruptions, but continuously the interruption jumps.
In the datasheet of 18f2550 don´t appears anything about usb interrupts in read serial port.
Thanks, good programming.

- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO and use of USB in Flowcode
Hello,
You will need to look at the following file to allow the USB interrupt to work correctly.
C:\Program Files\Matrix Multimedia\Flowcode V4\boostc\include\USB\usb_cdc_class.c
Open the file using a text editor and find the line.
void usb_ep_data_out_callback(uns8 end_point, uns8 *buffer, uns16 byte_count)
At the end of this function you can add a call to a Flowcode macro and this should be triggered when ever the USB receives any serial data.
I created a macro called test in Flowcode and then to reference this in the C code I edited the C function to look like this.
You will need to look at the following file to allow the USB interrupt to work correctly.
C:\Program Files\Matrix Multimedia\Flowcode V4\boostc\include\USB\usb_cdc_class.c
Open the file using a text editor and find the line.
void usb_ep_data_out_callback(uns8 end_point, uns8 *buffer, uns16 byte_count)
At the end of this function you can add a call to a Flowcode macro and this should be triggered when ever the USB receives any serial data.
I created a macro called test in Flowcode and then to reference this in the C code I edited the C function to look like this.
Code: Select all
void usb_ep_data_out_callback(uns8 end_point, uns8 *buffer, uns16 byte_count)
{
uns8 cdc_rx_next;
// We have some data!
if (end_point == CDC_DATA_ENDPOINT)
{ // it's the data end point
uns8 count;
for (count = 0; count < byte_count; count++)
{
cdc_rx_next = cdc_rx_end + 1; // get next buffer position
if (cdc_rx_next == CDC_RX_BUFFER_SIZE)
{ // if we're at the end
cdc_rx_next = 0; // then wrap to the beginning
}
if (cdc_rx_next != cdc_rx_start)
{ // if space in the fifo
cdc_rx_buffer[cdc_rx_end] = buffer[count]; // put it in
cdc_rx_end = cdc_rx_next; // and move pointer along
} // else... just ignore it, we've lost a byte, no room in the inn
}
//ADDED BR - Call to Flowcode Macro "test"
FCM_test();
}
}
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: ECIO and use of USB in Flowcode
I have not been able to make it run. The interruption does not run.
I have not enabled the USBINT because,what do I use Macro?
The USBINT does not enable peripheral interrupts.
Is it good?
Thanks

I have not enabled the USBINT because,what do I use Macro?
The USBINT does not enable peripheral interrupts.
Is it good?
Thanks
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO and use of USB in Flowcode
Hello,
The USBINT interrupt was used by the early beta USB component and should not be used in Flowcode v4 applications unless you are building a USB handler from scratch.
Does the test macro never get called at the moment then?
The USBINT interrupt was used by the early beta USB component and should not be used in Flowcode v4 applications unless you are building a USB handler from scratch.
Does the test macro never get called at the moment then?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: ECIO and use of USB in Flowcode
I mean, if i send something throught hyperterminal, the interrupt shoulbe jump.
I do this:
}
//ADDED BR - Call to Flowcode Macro "test"
FCM_test();
}
But no run.
Is it necesary enable the USBINT?
Yes: My program only do the interrupt, not run the main program.
No: My program is only doing the main program, and don´t jump the interrupt.
Thanks for everything.
I do this:
}
//ADDED BR - Call to Flowcode Macro "test"
FCM_test();
}
But no run.
Is it necesary enable the USBINT?
Yes: My program only do the interrupt, not run the main program.
No: My program is only doing the main program, and don´t jump the interrupt.
Thanks for everything.
- Attachments
-
- USBINT.fcf
- (10.5 KiB) Downloaded 519 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO and use of USB in Flowcode
Hello,
I just tried your program as is and its working great for me. Did you edit the usb_cdc_class.c function like I mentioned above to include the call to FCM_test();
You do not need to enable the USBINT and should never need to use it with the USB components.
Also I noticed that your clock speed in the project options is set to 16MHz. USB runs at 48MHz (12MIPs) so your delays will currently be much shorter then they should be. Changing the clock speed to 48000000 should allow the delays to run at the correct speed.
I've also had a quick look at your config settings and my only suggestion would be to change the USB voltage regulator setting so it is enabled.
I just tried your program as is and its working great for me. Did you edit the usb_cdc_class.c function like I mentioned above to include the call to FCM_test();
You do not need to enable the USBINT and should never need to use it with the USB components.
Also I noticed that your clock speed in the project options is set to 16MHz. USB runs at 48MHz (12MIPs) so your delays will currently be much shorter then they should be. Changing the clock speed to 48000000 should allow the delays to run at the correct speed.
I've also had a quick look at your config settings and my only suggestion would be to change the USB voltage regulator setting so it is enabled.
- Attachments
-
- itworks.JPG (54.11 KiB) Viewed 24869 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: ECIO and use of USB in Flowcode
Yes, you're right.
This run ok, but two questions.
The first,quartz xtal 20MHz preescaller 5 (20/5=4 to PLL) -> (PLL/2=48) ->CPUDIV (no divide selected, then /2 )-> (48/2=16)
The second,therefore, when would be it use the USBINT?
Thanks Benj.
This run ok, but two questions.
The first,quartz xtal 20MHz preescaller 5 (20/5=4 to PLL) -> (PLL/2=48) ->CPUDIV (no divide selected, then /2 )-> (48/2=16)
The second,therefore, when would be it use the USBINT?

Thanks Benj.

- Attachments
-
- 18f2550 osc.png
- (69.85 KiB) Downloaded 5009 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO and use of USB in Flowcode
Hello,
48/2 is not 16. Also the final divide is /4 so 48/4 = 12MHz.The first,quartz xtal 20MHz preescaller 5 (20/5=4 to PLL) -> (PLL/2=48) ->CPUDIV (no divide selected, then /2 )-> (48/2=16)
The second what? For the USB to work the chip must be running ta the speed of 12MIPs to allow the full speed USB to work correctly.The second,therefore, when would be it use the USBINT?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: ECIO and use of USB in Flowcode
Sorry, 48/3=16 (it is bad in the example).
I write the speed of the program, not the Xtal, Is it good?
My USB run OK and the inerrupt work excellent, then,
What,How,Where, is the use of this USBINT?
Thank you so much for answered me.
I write the speed of the program, not the Xtal, Is it good?
My USB run OK and the inerrupt work excellent, then,
What,How,Where, is the use of this USBINT?

Thank you so much for answered me.

- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: ECIO and use of USB in Flowcode
Hello,
As stated earlier.
As stated earlier.
The USBINT interrupt was used by the early beta USB component and should not be used in Flowcode v4 applications unless you are building a USB handler from scratch.
The program speed must be 48MHz or 12MIPs (48 / 4) to allow full speed USB to work. If your device is working then you have everything setup correctly.You do not need to enable the USBINT and should never need to use it with the USB components.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel