B4J Question GPIO state change interrupts

techknight

Well-Known Member
Licensed User
Longtime User
Is there a way to run the GPIO in its own thread?

the State Change interrupts are monitoring 2 flip-flop Q outputs I have in circuit, and its very hit or miss.

its supposed to trigger the interrupt, and then when the routine fires, it toggles a GPIO pin to clear the flip-flops and read the byte from the peripheral.

it works about 80% of the time, but sometimes the flip-flop will latch into a high state, but the interrupt is entirely missed by the pi.

any ideas? Thanks.
 

techknight

Well-Known Member
Licensed User
Longtime User
Well, its not the hardware because prior to moving to the Pi, I was using a Micro/Arduino and it worked fine. I moved to the Pi because Arduino Serial over USB is too slow, and the GPIO seems to be much faster.

With the exception of this particular side-effect. Something may be wrong with the listener? regardless it wont detect the state change "sometimes". and I know the states change because I am monitoring those flip-flops with a logic probe. They go high. but Pi goes wooosh.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Thought about that originally, but not enough I/O. I am driving a parallel bus with flow control lines and a FIFO.

I am doing something rather unique that I dont know if anyone else here has done before. I am bootstrapping and controlling an old 68K machine from a Raspberry Pi and a B4J app. Works fine for the most part, just these little quirks from time to time.

The Pi isnt "directly" connected to the bus, there are some decoder and control logic and FIFO so the Pi doesn't have to conform to the 68K bus cycle, plus 5V to 3.3V transceivers.

I may need to meet in the middle somewhere and use a simple microcontroller to handle the interrupt logic, and feed those acknowledgements over some type of USB serial and handle it that way.
 
Last edited:
Upvote 0

miker2069

Active Member
Licensed User
Longtime User
Thought about that originally, but not enough I/O. I am driving a parallel bus with flow control lines and a FIFO.

I am doing something rather unique that I dont know if anyone else here has done before. I am bootstrapping and controlling an old 68K machine from a Raspberry Pi and a B4J app. Works fine for the most part, just these little quirks from time to time.

The Pi isnt "directly" connected to the bus, there are some decoder and control logic and FIFO so the Pi doesn't have to conform to the 68K bus cycle, plus 5V to 3.3V transceivers.

I may need to meet in the middle somewhere and use a simple microcontroller to handle the interrupt logic, and feed those acknowledgements over some type of USB serial and handle it that way.
As an a Motorola 68000 processor? If so that's a blast from the past. If it's possible to share (at a high level) what are you doing? I was a big fan of the Motorola 68000 "back in the day" (primarly Amiga computers). Just being nosey :) - If you can't share, totally understand - rock on!
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
As an a Motorola 68000 processor? If so that's a blast from the past. If it's possible to share (at a high level) what are you doing? I was a big fan of the Motorola 68000 "back in the day" (primarly Amiga computers). Just being nosey :) - If you can't share, totally understand - rock on!

Sure! No problem, here is a couple links:

and:
 
Upvote 0

miker2069

Active Member
Licensed User
Longtime User
Sure! No problem, here is a couple links:

and:
That is incredibly cool stuff! Who doesn't know about those weather maps from the late 80s and 90s! Honestly if you told me that they're using something different I wouldn't know - other than smoother graphics basically looks the same to me. I had to re-read your post a few times to "get it" (kinda). You're doing some serious bit slicing there! Clearly you have some embedded systems background to take a box and reverse engineer it from scratch. I assume you're grabbing weather info via your PI and the internet and funneling into your weatherstar. I assume you had a basic understanding of the format/data to feed into it for it to display properly?

Anyway, I am always fascinated by people who do this stuff at a low level - reminds me of Bitluni on youtube (one of my favorite arduino/esp8266 channels) - he picks something (like video on a arduino mega) and goes insanely deep on it.

Good stuff - and good luck - thanks for sharing!
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
I had to re-write everything, the ROMs, the programs that run in RAM, as well as writing the B4J App on the Pi.

And yes, the Pi is responsible for reaching out to the multiple web APIs and pulling in the data as well as formatting it to be sent via FIFO into the unit through an interrupt handler on theother end (68K) side.

I had to write a task switching kernel for the graphics card because things have to happen in parallel like background drawing, the lower display line ticker at the bottom, and the clock. Without that, they were interrupting one another and stalling.
 
Upvote 0
Top