ChiBIOS 3.0.0. and USB

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
avrhack
Posts: 140
Joined: Tue Dec 24, 2013 1:42 pm
Has thanked: 17 times
Been thanked: 3 times

ChiBIOS 3.0.0. and USB

Post by avrhack »

OK so I've bitten the bullet and moved code that was working fine until 2.6.8 onto 3.0.0. I've read the changes and after a bit of pain managed to get everything to compile nicely but it doesn't run. Firing up gdb suggests it's in USB initialisation but there's something strange going on even with the debugger i.e. it doesn't seem to follow the logical control flow!

Anyone had any luck moving a 2.6.8 USB application across to 3.0.0 and any further hints and tips - I was hoping it would be a lot more seamless than it's turning out to be.....

Thanks.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: ChiBIOS 3.0.0. and USB

Post by Giovanni »

Compile using -O0, enable checks, assertions and state checker in chconf.h, etc etc

Giovanni
avrhack
Posts: 140
Joined: Tue Dec 24, 2013 1:42 pm
Has thanked: 17 times
Been thanked: 3 times

Re: ChiBIOS 3.0.0. and USB

Post by avrhack »

Giovanni wrote:Compile using -O0, enable checks, assertions and state checker in chconf.h, etc etc

Giovanni


All checks are enabled - already were in the 2.6.8 working version. I will change from O2 to O0 though and retry.

Was really after some insight into whether the drivers have materially changed or not or whether following all the fixes in the 3.0.0. upgrade guide in theory should make it work......
avrhack
Posts: 140
Joined: Tue Dec 24, 2013 1:42 pm
Has thanked: 17 times
Been thanked: 3 times

Re: ChiBIOS 3.0.0. and USB

Post by avrhack »

Ok so the problem is actually nothing to do with USB. Compiling with O0 at least makes the debugger work. It seems the following line works:

chBSemObjectInit(&sendInProgress, 0);

whereas the following line blocks:

chBSemObjectInit(&noDataReceived, 1);

There's an obvious difference! But as SF is offline I can't consult the online manual. Interestingly this all worked fine in 2.6.8 so I suspect it's some bug in my code that was tolerated by 3.0.0. Unfortunately have run out of time this evening to squash this one but looks like I'm very close as USB device appears fine if I get rid of this line so clearly my use of semaphores is not up to scratch!
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: ChiBIOS 3.0.0. and USB

Post by Giovanni »

The second parameter is a boolean: false=taken, true=not_taken.

How do you mean to initialize it?

BTW, all the manual is in the source code :), look into the binary semaphores header. Manuals are generated from those comments.

Giovanni
avrhack
Posts: 140
Joined: Tue Dec 24, 2013 1:42 pm
Has thanked: 17 times
Been thanked: 3 times

Re: ChiBIOS 3.0.0. and USB

Post by avrhack »

Giovanni wrote:The second parameter is a boolean: false=taken, true=not_taken.

How do you mean to initialize it?

BTW, all the manual is in the source code :), look into the binary semaphores header. Manuals are generated from those comments.

Giovanni


So this code of mine hasn't changed. Yet trying to initialise it as true=not_taken just loops indefinitely. **EDIT** having debugged this again it now gets past this statement. In fact the issue is a timing one with interrupts. Two lines further on is icuEnableNotifications(receiveICU); If that is commented out things work reliably, with it left in they fail so it's something to do with the ICU driver. Need to check what has changed around this area in 3.0.0. as it all worked perfectly in 2.6.8......

Good point about the source though - will go and work through it now :)
Post Reply