USB on STM32F750.

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

User avatar
Giovanni
Site Admin
Posts: 13085
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 759 times
Been thanked: 637 times
Contact:

Re: USB on STM32F750.

Postby Giovanni » Fri Jun 05, 2020 4:39 pm

rew wrote:The way I understand things, EITHER you specify rxbytes zero OR you need rxbuf to be nonzero, right?
....
What's going on?


Correct

I don't know, try stepping at asm level, it is possible you are looking at the wrong thing.

Giovanni

rew
Posts: 341
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 11 times

Re: USB on STM32F750.

Postby rew » Sat Jun 06, 2020 9:08 am

Single stepping is NOT possible. Every time when I stop the CPU, and then try to step or next to the next statement it goes into an interrupt.

For now I've created and pass a dummy/not used RX buffer. That got me to a timeout on the I2C transmit. Not sure if it is hardware or not. I have a development board that has been able to talk to the I2C chips on the previous version of this board (where I had botched the footprint for the CPU). So that's one thing to try to verify the I2C bus is working correctly. (Multimeter already says: no shorts, logic analyzer says that I can toggle the pins as outputs both as "opendrain" as "pushpull").

This: "the C-code specifies one thing" and "it seems to do another" does not make me have confidence in the compiler.

User avatar
Giovanni
Site Admin
Posts: 13085
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 759 times
Been thanked: 637 times
Contact:

Re: USB on STM32F750.

Postby Giovanni » Sat Jun 06, 2020 10:06 am

You could try moving the lock() before checks, just to debug.

Giovann

mikeprotts
Posts: 151
Joined: Wed Jan 09, 2019 12:37 pm
Has thanked: 19 times
Been thanked: 23 times

Re: USB on STM32F750.

Postby mikeprotts » Sat Jun 06, 2020 11:55 am

rew wrote:Single stepping is NOT possible. Every time when I stop the CPU, and then try to step or next to the next statement it goes into an interrupt.


Setting break points on the lines in question and using cont is how I avoid this sort of problem. When I run out of breakpoints I delete the one I've just stopped on and add another.

The listing should tell you if the compiler is producing good code, it's probably worth comparing with and without optimisation.

Mike

rew
Posts: 341
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 11 times

Re: USB on STM32F750.

Postby rew » Sat Jun 06, 2020 6:40 pm

With a dummy RX buffer it got past the checks. Then it locked on the second i2c transmit. This turned out to be that I had copied over the code from the '072(*): I had used AF1 for I2C on the F0 series, but it's AF4 on F7xx. This wouldn't have happened if there was a define that evaluates to 1 on the F0 and 4 on the F7. There probably is, but the example code needs to show how set the pad modes (with a comment that on this specific board for these specific pins it is not necessary) and how to do this. As it is, it is much easier to just look up the pad AF in the chip manual and use the number.

I had realized I needed to do this, as I remember it, I looked it up and changed the code. However it didn't arrive that way in the code I was actually testing today.

Then the data sent was correct on the "initialization sequence" but not afterwards. Adding a cacheflush before the transmit helped. Then the readback showed bad results. Again a cache flush helped, now a cache invalidate for the readback.

I then wrote my own wrapper around i2cMasterTransmitTimeout that will do the flush/invalidate before after each i2cMasterTransmit call. Then I forced that function to be the only mention of i2cMasterTransmitTimeout and then it worked perfectly first time! (seems that before I was missing one of the flushes).

On to writing the rest of the application..... Finally.


(*) I have an STM32F072 development board that I desgined. I remember explaining that to you guys but it seems I didn't hit "submit" on that message (yet).


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 1 guest