USB Slave examples

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
TSMroz
Posts: 15
Joined: Wed Apr 19, 2017 2:54 pm
Been thanked: 2 times
Contact:

USB Slave examples

Post by TSMroz »

Hi. Keep in mind, I'm a complete newbie to all of this.. I'm trying to do my first code example with the IDE using the USB Slave Component. I've tried using both examples from this page:

https://www.matrixtsl.com/wikiv7/index. ... 425b14462f

Neither example on the page will compile without numerous errors. I haven't altered the examples other than changing the target chip. Am I doing something wrong?

Employing 18F2550 errata work-arounds:
* Corrupted fast interrupt shadow registers
USB_Slave.c:
368: DATA_PACKET INPacket;
^ (374) missing basic type; int assumed (warning)
^ (372) "," expected
369: DATA_PACKET OUTPacket;
^ (374) missing basic type; int assumed (warning)
^ (372) "," expected
USB_Slave.c: IsTxBusy()
440: return (bd1in.stat & (1 << UOWN));
^ (192) undefined identifier "bd1in"
^ (196) struct/union required
^ (192) undefined identifier "UOWN"
USB_Slave.c: FCD_07281_USB_Slave__SendString()
944: INPacket._byte[FCL_IDX] = FCL_DATA[FCL_IDX];
^ (196) struct/union required
(981) pointer required ^
(981) pointer required ^
962: USBGenericInHandle = USBTransferOnePacket(1,1,(BYTE*)&INPacket,FCL_LENGTH);
(192) undefined identifier "BYTE" ^
(195) expression syntax ^
(187) too few function arguments ^
(194) ")" expected ^
(195) expression syntax ^
USB_Slave.c: FCD_07281_USB_Slave__GetString()
993: FCR_RETVAL[FCL_IDX] = OUTPacket._byte[FCL_IDX];
(196) struct/union required ^
(981) pointer required ^
(981) pointer required ^
USB_Slave.c: FCD_07281_USB_Slave__RunSlaveService()
1040: FCM_slave_service(OUTPacket._byte[0]);
(196) struct/union required ^
(981) pointer required ^
(981) pointer required ^
1140: USBGenericInHandle = USBTransferOnePacket(1,1,(BYTE*)&OUTPacket,1);
(192) undefined identifier "BYTE" ^
USB_Slave.c: 1140: too many errors (21)



Thanks!

TSMroz
Posts: 15
Joined: Wed Apr 19, 2017 2:54 pm
Been thanked: 2 times
Contact:

Re: USB Slave examples

Post by TSMroz »

Anyone? Perhaps not supported on 8 bit pics?

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: USB Slave examples

Post by Benj »

Hmm,

This used to work in v6 but seems to have a problem with v7 currently, the other two USB components Serial and HID are ok with 8-bit PIC so hopefully we can solve this one for you too.

I'll investigate and see if I can find you a resolution or work around.

TSMroz
Posts: 15
Joined: Wed Apr 19, 2017 2:54 pm
Been thanked: 2 times
Contact:

Re: USB Slave examples

Post by TSMroz »

Thank you, Ben.

TSMroz
Posts: 15
Joined: Wed Apr 19, 2017 2:54 pm
Been thanked: 2 times
Contact:

Re: USB Slave examples

Post by TSMroz »

Just checking in. I can bribe with beer if needed :D

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: USB Slave examples

Post by LeighM »

We currently have a plan to overhaul the USB support over the coming weeks.

Roy Johnston
Flowcode V4 User
Posts: 220
Joined: Mon Aug 24, 2009 8:38 am
Has thanked: 2 times
Been thanked: 34 times
Contact:

Re: USB Slave examples

Post by Roy Johnston »

has this problem been resolved?
i still cannot compile with usb slave

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: USB Slave examples

Post by LeighM »

Updated component attached.
Please drop this into your Flowcode7 components directory
Attachments
USB_Slave.fcpx
(17.75 KiB) Downloaded 255 times

Roy Johnston
Flowcode V4 User
Posts: 220
Joined: Mon Aug 24, 2009 8:38 am
Has thanked: 2 times
Been thanked: 34 times
Contact:

Re: USB Slave examples

Post by Roy Johnston »

Thank you,
its working.

Post Reply