Having blue screens with ECIO-40P

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
alazaro
Posts: 20
Joined: Mon Jun 15, 2009 1:06 pm
Location: Lisbon, Portugal

Having blue screens with ECIO-40P

Post by alazaro »

Hi all!

I'm having some problems using ecio-40P. I’m using Flowcode3 and VB.NET. I've been using this modulo for several months and for about two weeks ago I started to have blue screens when I'm transmitting data.

The program that I developed must transmit data between ECIO and the PC during execution time and for that I follow the example that came with the USB Pack, the USB Examples Slave.

I’ve use it with no problem until now, it starts to generate blue screens and when I tried to install the ECIO in another PC I wasn’t able to do it. No matter what I do it just do not open the connection.

I believe that these blue screens happened when I use the function ECIO_Transmit() and when it's to transfer data from the ECIO to the computer, does it happened to any of you before? Do you have any idea?

I also test some hardware of my computer, the only one that can open a connection with the EIO-40P, like the RAM and hardrive but the results where OK.

Any answer will be appreciated.
Thanks,
Γ‚ngela
Regards,
Ângela

User avatar
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: Having blue screens with ECIO-40P

Post by Benj »

Hello Γ‚ngela

How often do the blue screens occur? I have experienced some blue screens but only if I am performing a "get count" function or a "connect" function and I impatiently unplug the device from the USB.

Do you have any other ECIO devices or any other matrix PIC products connected to your PC?

What time out value are you using on your "ECIO_Transmit()" function?

When installing the ECIO onto another PC are you using the ECIO driver or the USB Slave driver. I think the PC will require both to be installed correctly to allow the ECIO to connect in slave mode.

alazaro
Posts: 20
Joined: Mon Jun 15, 2009 1:06 pm
Location: Lisbon, Portugal

Re: Having blue screens with ECIO-40P

Post by alazaro »

Hello Benj

Thanks for your reply!

Well, the blue screens occur when my program transfers data from the ECIO to the PC. It’s not always in the same part of code. Sometimes it’s possible to transmit 10 blocks of 128 bytes others less or more. The number of blocks that I’m able to transfer differ, but it only let me transfer 20 blocks top.

I only use the ECIO-40P device; it’s with this device that I connect some hardware to the PC. This hardware stills work and had worked perfectly well before. I even tried last versions of my software, the ones that had worked, but the blue screens still happened.

I’m using 500 to the timeout value in the "ECIO_Transmit()" function.

When I tried to install the ECIO onto another PC I only use the ECIO driver. When you mentioned the USB Slave driver is the executable named “PDFSUSB.exe” that came with the USB PACK?

Regards,
Γ‚ngela
Regards,
Ângela

User avatar
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: Having blue screens with ECIO-40P

Post by Benj »

Hello Γ‚ngela

Ok I think I may have spotted the problem. If you are trying to send an array of 128 bytes then the component probably isn't going to like this very much.

The component is currently set to have a buffer of 32 bytes that it uses for its transfer buffer. If you want to up this to a more acceptable value eg 128 then you can go into the component code file and change the following settings.

Flowcode V3

#define USB_EP1_IN_SIZE 32
#define USB_EP1_IN_ADDR 0x0510
#define USB_EP1_OUT_SIZE 32
#define USB_EP1_OUT_ADDR 0x0530

should become

#define USB_EP1_IN_SIZE 32
#define USB_EP1_IN_ADDR 0x0510
#define USB_EP1_OUT_SIZE 128
#define USB_EP1_OUT_ADDR 0x0530

Flowcode V4

#define USB_EP0_OUT_SIZE 8
#define USB_EP0_IN_SIZE 8
#define USB_EP1_IN_SIZE 32
#define USB_EP1_OUT_SIZE 32

should become

#define USB_EP0_OUT_SIZE 8
#define USB_EP0_IN_SIZE 8
#define USB_EP1_IN_SIZE 32
#define USB_EP1_OUT_SIZE 128

You can also up the size of the incoming data buffer if you are sending large amounts of data in one go from the PC. If you do want to do this then you will need to change the EP1 out address accordingly to allow the incoming buffer to fit into memory correctly.

You may also need to check that the data has been sent before trying to send the next set of data. In flowcode when you send data via the component there is a return value to let you know if the transfer has been successful. If this value comes back as 1 then there is still data in the USB buffer that has not yet been shifted out to the PC. In a normal working system this value should never really go to 1. Detecting a 1 normally means that the PC has become disconnected from the device.

alazaro
Posts: 20
Joined: Mon Jun 15, 2009 1:06 pm
Location: Lisbon, Portugal

Re: Having blue screens with ECIO-40P

Post by alazaro »

Hello Benj!

My code already has these settings, other wised it wouldn’t be possible to transfer blocks of 128 bytes each.

To transfer data from the ECIO to the PC I’m using the component macro, “Send_String(String(STRING), Length(BYTE))”, this function does not have a return value. From the PC I’m waiting for the data using:

Code: Select all

nRxDataCnt = 0
While nRxDataCnt = 0
   lRetVal = ECIO_Transmit(bDataOut1_1(0), 0, nTxDataCnt, bDataIn1_1(0), 128, nRxDataCnt, 500)
End While
My data are 5 blocks of 128 bytes, so I repeat this code five times,

Code: Select all

nRxDataCnt = 0
While nRxDataCnt = 0
   lRetVal = ECIO_Transmit(bDataOut1_1(0), 0, nTxDataCnt, bDataIn1_1(0), 128, nRxDataCnt, 500)
End While
nRxDataCnt = 0
While nRxDataCnt = 0
   lRetVal = ECIO_Transmit(bDataOut1_1(0), 0, nTxDataCnt, bDataIn2_1(0), 128, nRxDataCnt, 500)
End While
nRxDataCnt = 0
While nRxDataCnt = 0
   lRetVal = ECIO_Transmit(bDataOut1_1(0), 0, nTxDataCnt, bDataIn3_1(0), 128, nRxDataCnt, 500)
End While
nRxDataCnt = 0
While nRxDataCnt = 0
   lRetVal = ECIO_Transmit(bDataOut1_1(0), 0, nTxDataCnt, bDataIn4_1(0), 128, nRxDataCnt, 500)
End While
nRxDataCnt = 0
While nRxDataCnt = 0
   lRetVal = ECIO_Transmit(bDataOut1_1(0), 0, nTxDataCnt, bDataIn5_1(0), 128, nRxDataCnt, 500)
End While
I use this because the ECIO is the slave in the connection so any transfer must start from the computer side, which is the master.

The blue screens happened in one of these lines. But this is not new; I’ve used this for some moths and work fine. Do you think that the ECIO could be damage or not working properly? Could it be the source of the blue screens?

But I think I could check the return value instead, do you think it’s a better way?

One more thing, in your first reply you mentioned a driver for the USB_Slave component.. is it really necessary and does it came with the USB PACK?

Thank you very much,
Γ‚ngela
Regards,
Ângela

User avatar
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: Having blue screens with ECIO-40P

Post by Benj »

Hello

Great I seemed to remember helping someone to increase the size of their In/Out buffers.

The Flowcode Slave component itself generates the driver for the Flowcode USB component. You can do this via the Flowcode component properties page. You will also need the ECIO driver as there are files contained in this that are used in the installation of the Flowcode Slave driver.

If the ECIO has been running for months ok and now you are suddenly having a problem then maybe it is the ECIO device itself at fault. If you are overwriting the flash memory on a regular basis in your program then please be aware that there is a limitation of about 10,000 read / write operations. The code in RAM such as standard variables should not be effected by this limitation.

alazaro
Posts: 20
Joined: Mon Jun 15, 2009 1:06 pm
Location: Lisbon, Portugal

Re: Having blue screens with ECIO-40P

Post by alazaro »

Hello Ben!

That’s right, I’m the one you help that time… and others before ;)

Just to be sure that I got it right; English is not my primary language has you notice.

What do you mean with
If you are overwriting the flash memory on a regular basis in your program then please be aware that there is a limitation of about 10,000 read / write operations
When you mentioned overwriting the flash memory is that I can only flash my program to the ECIO for about 10,000 times… right? But that will not influence the data transmitting? I mean, I do not have that limitation regarding the transfer of bytes between PC and ECIO?

I’m sorry about this one.

Thanks,
Γ‚ngela

P.S – I’ll try to use a new ECIO and than I let the forum know
Regards,
Ângela

User avatar
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: Having blue screens with ECIO-40P

Post by Benj »

Hello
When you mentioned overwriting the flash memory is that I can only flash my program to the ECIO for about 10,000 times… right?
Yes this is correct. There are also C function routines that can be used to directly read and write the flash but unless you are specifically using these then there should not be a problem.

Yes les me know how you get on with a new device. If it starts having the same problem then if you pass me your Flowcode file (via a PM if you dont want the file made public) then I will do some testing here using my USB analyser hardware and see if I can spot a problem.

alazaro
Posts: 20
Joined: Mon Jun 15, 2009 1:06 pm
Location: Lisbon, Portugal

Re: Having blue screens with ECIO-40P

Post by alazaro »

Hello Ben!

I’ve not tried with a different and new device but I’ve tried in a different Computer and the blue screens do not appear. It seems that the problem is somewhere in the other computer although the blue screens only appear when I use the ECIO but so many things are used at the time…

I also notice some problems when transmitting blocks of 128 bytes using the ECIO_Transmit() function and a USB 1.0 port. The program stops and do not answer.

I’ve tried to install the ECIO-40P as a USB slave in a computer running Windows Vista and I wasn’t able to do it with success. I can install the ECIO-40P and flash it with the ECIOProg.exe but I cannot run the ECIO has a USB slave.

No more news so far.
Regards,
Ângela

User avatar
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: Having blue screens with ECIO-40P

Post by Benj »

Hello Γ‚ngela

Thanks for letting me know, Glad the blue screens are only happening on a single PC maybe there is a hardware or software conflict somewhere that is causing problems with the data transfer,

Regarding the USB 1.0 I think that the Microchip USB transceivers are USB 2.0 and expect this to allow the USB components to enumerate correctly.

Regarding getting the USB slave device to work with Vista. Have you generated the driver using Flowcode and then tried to manually install this driver for the USB device? You will probably also have to deactivate the power management setting in device manager to allow it to work correctly.

alazaro
Posts: 20
Joined: Mon Jun 15, 2009 1:06 pm
Location: Lisbon, Portugal

Re: Having blue screens with ECIO-40P

Post by alazaro »

Hello Ben!!

I'm back and I'm back with the blue screens.
It work during sometime but after a while the blue screens started.
I’ve been doing some tests and I have some doubts about the function ECIO_Transmit().
What is the return value of this function? 0 means sent ok or is it 1?
And in my code in order to protect it and be sure that I do not send more data until the first one have been totally and correctly sent, should it be:

Code: Select all

lRetVal = 1
lRetVal = ECIO_Transmit(bDataOut1(0), DataOut1_SIZE + 1, nTxDataCnt, bDataIn1(0), 0, nRxDataCnt, 500)
While lRetVal = 1

End While

lRetVal = 1
lRetVal = ECIO_Transmit(bDataOut2(0), DataOut2_SIZE + 1, nTxDataCnt, bDataIn1(0), 5, nRxDataCnt, 500)
While lRetVal = 1

End While

OR

Code: Select all

lRetVal = 1
lRetVal = ECIO_Transmit(bDataOut2(0), DataOut2_SIZE + 1, nTxDataCnt, bDataIn1(0), 5, nRxDataCnt, 500)
While lRetVal = 1
lRetVal = ECIO_Transmit(bDataOut2(0), DataOut2_SIZE + 1, nTxDataCnt, bDataIn1(0), 5, nRxDataCnt, 500)
End While
Cause I solved the problem, aparently and so far, by adding a while to consume some time.

Many thanks,
Γ‚ngela LΓ΅zaro


P.S - I also tried with a brand new ECIO-40P and the problem persists.
Regards,
Ângela

Post Reply