I was trying to read/write a 8 byte value directly to the GPIO port.
Is it possible to do that with one call rather than have to do it bit-by-bit.
Something like PORTA = PORTB | MASK?
AVR Based arduinos would probably do that.
Here you can see how to read the entire port that the pin you want is on:
https://gist.github.com/technobly/8573877
And here is how to write individual bits:
https://gist.github.com/technobly/8342185
To write the whole port you need to write to the ODR (Output Data Register), so it should be something like this:
PIN_MAP[pin].gpio_peripheral->ODR = 0xFFFF;
Except this still seems like it might be missing something… so keep us updated on what you dig up.
You might want to take a look at STM32F Reference Manual (RM0008) (9.2MB)
This is absolutely possible @lbarrosoneto. You will find though that the ARM processor is both more powerful than the AVR chips you’re used to, and a little more complicated to deal with.
Get the reference manual for the STM32F103CBT6. You can just read chapter 9 on GPIO to see exactly how it’s done.
Some educational snippets from firmware:
- The definition of digitalWrite
- The definition of digitalRead
- The PIN_MAP definition of which ports and peripherals to use for each pin
- The pin info structure so you know the field names for the PIN_MAP
In particular you’ll want to read from the IDR (input data register) and write to the ODR (output data register) for a particular port after the port is configured…
Aaaaaand I see @BDub just beat me to the punch, with an even better answer.
Happy hacking!
Damnit, I had a long ass reply typed up, got sidetracked, come back annnd I’m beaten like Rihanna
at the Grammies.
@BDub even included pretty pictures!
I have an idea… next time we are thinking of making a long-winded detailed reply, we should post a temporary reply stating we are working on a reply!
That way we can spread out the awexomeness to other topics
Good call. I've had the same issue a few times before as well. I just need to figure out how to make that work with e-mail as well.
Thank you very much, Guys!
Looks like a great answer. It could be improved by updating the broken links!