Search found 6 matches

by jwiggams
Tue Dec 29, 2020 1:25 am
Forum: General discussion
Topic: Bluepill port manipulation - need help understanding registers
Replies: 3
Views: 4066

Re: Bluepill port manipulation - need help understanding registers


Starting point would be to look at section 9.2.1 in the reference manual (RM0008).

From that you would see that in CRL, there are four bits for each for each GPIO 0 to 7, so each hex digit of the value written to CRL sets the config and mode for one of those GPIO pins.

GPIOA->CRL = 0x00033003 ...
by jwiggams
Mon Dec 28, 2020 9:23 pm
Forum: General discussion
Topic: Bluepill port manipulation - need help understanding registers
Replies: 3
Views: 4066

Bluepill port manipulation - need help understanding registers

Hey all,

Trying to work with these pins as quickly as possible, so I need to avoid pinMode and digitalWrite functions. I'm trying to set pins as input and output, but I can't make any sense of how people are using the CRL and CRH functions for it. Like I've seen where writing "GPIOA->CRL ...
by jwiggams
Tue Nov 24, 2020 10:21 pm
Forum: General discussion
Topic: Bluepill need help with interrupt
Replies: 7
Views: 8630

Re: Bluepill need help with interrupt coding with Sega Genesis


read once the GPIOA and B IDR ports quickly, then put the value together:
uint32 pa = GPIOA->IDR;
uint32 pb = GPIOB->IDR;
byte value = (pa & 0x...) | (pb & 0x...)
But I recommend to use only pins of one port, e.g. GPIOA or GPIOB.


That's the ticket, it works! You're right, one port would be ...
by jwiggams
Tue Nov 24, 2020 5:22 pm
Forum: General discussion
Topic: Bluepill need help with interrupt
Replies: 7
Views: 8630

Re: Bluepill need help with interrupt coding with Sega Genesis



Maybe use
noInterrupts();
interrupts();
while fetching data (and/or address)bus.



That works a lot better! At least for reading a single bit (bit 0), its showing correct values every time. I wasn't thinking about turning off the interrupts because that kills my software serial, but I'd ...
by jwiggams
Mon Nov 23, 2020 9:48 pm
Forum: General discussion
Topic: Bluepill need help with interrupt
Replies: 7
Views: 8630

Re: Bluepill need help with interrupt coding with Sega Genesis

I've got a pretty small window. The data pins are valid at the rising edge of nTIME, and that could be my issue - that I'm not getting it fast enough once that edge happens. But when i sample the data before the rising edge, it's wrong as well.

Based on your suggestion to remove the interrupts ...
by jwiggams
Mon Nov 23, 2020 8:51 pm
Forum: General discussion
Topic: Bluepill need help with interrupt
Replies: 7
Views: 8630

Bluepill need help with interrupt

Hi all,

Just getting started with the Bluepill, and so far things have been going well. But I've run into a snag with using interrupts.

I have this interfaced to a Sega Genesis console, and what I want is whenever I write to a certain address the byte value is grabbed and sent out to my serial ...

Go to advanced search