[Demo]TTB TinyBasic (USBSerial)

It is now:

1 Like

hmmm, nope. doesn’t work for me. Just white screen. Perhaps my pokittolib is the wrong version.

With the USB plugged in?

Yup, I rarely unplug it.

It works for me using PokittoIO.
Try updating your PokittoLib.

I am new to Pokitto and wanted to try this USBSerial example

I am using the onlnie mbed environment and after success with the ‘helloworld’ example I now find the USBSerial doesn’t seem to be part of the PokittoLib.

Are there different versions of the PokittoLib?

Did the mbed version fall behind and there is some other preferred development path.

2 Likes

Hi, Welcome to Pokitto!
I currently prefer FemtoIDE [Tool]FemtoIDE It is always up to date, sometimes cutting edge when it comes to PokittoLib updates. It enables you to use a range of languages and comes with the latest version of the Pokitto emulator.

2 Likes

Hmm… FemtoIDE seems cool. I downloaded it (windows 10) and it ran the first time in java mode but after that I kept getting some sort of No windows pipeline error or similar.

I did manage the fork the git PokittoLib git and import it into mbed and then (somehow) update the HelloWorld PokittoLib with the USBDevice directory after which the above code example by [Pharap] worked! So that’s a baby step in the right direction.

3 Likes

USBserial is a separate mbed library

It was included in the git repo but is not part of the mbed PokittoLib which confused me.
Not sure the ‘correct’ mechasim for importing a standard mbed libary but I did also manage to bind the BufferedSerial to the PEX uart so I made another step now of a USB : UART pass-through. Starting to get fun.

4 Likes

Very few are nowadays using mBed online. Femto is the way to go, Embitz and CodeBlocks are used as well.

Sounds like you opened Hello Java or started a new java project and you’re trying to compile it for the simulator. Try opening Hello CPP, P-Type, or making a new C++ project.
On the top bar there’s a drop-down where you can choose between compiling for the Pokitto or windows.

  • Selecting “windows” then clicking on Build->Build will give you an EXE file that uses the Simulator.
  • Selecting “Pokitto” then clicking on Build->Build will give you a BIN file that you can run in the included Emulator or on the Pokitto Hardware.

Ok Got it… next question

The example uses an update() callback which clears the framebuffer and expects a full draw frame?

What I want to do is the following

  • Screen is not cleared between frames
  • Using setTile() ? rectangles of full 16 bit color pixels are rendered directly to (x,y,width,height)

Is this something the simulator can simulate? Is update() with clear needed?

To explain : I am trying to receive compressed frames of dirty pixels in blocks over the serial USB and render them on the fly directly to the LCD to create sort of a ‘gif’ player at full color.

Not sure of the special requirements for preventing visual flicker/tearing during a block update. Any tips on that would be appreciated.

The PokittoLib comes with some screen modes you might want to look at. All except for TAS can use persistence to prevent clear when updating. TAS doesn’t have a framebuffer so persistence isn’t an option with it.

To draw full color you’re going to have to use Direct mode and draw to the LCD directly. As for avoiding flicker and using dirty frames, you might want to try simply refreshing the entire screen. It shouldn’t be too bad, as you can see here (capturing the PC’s screen, resizing, sending it over USB, receiving Pokitto’s button states and translating them back to joypad inputs on the PC).

1 Like

yes, PokittoRemote is what I want…

Except - I want to also pass back UART (or SPI) serial data and the screenshots I send are not full video and are highly compressable with lots of flat color sections. I see from your PokittoRemote you rely on the (higher than I realised) USB CDC throughput but you still use a pallete. Is the pallete to reduce the send data ( 1 byte per pixel ) vs 2 byte per pixel full color. Hence I was thinking dirty rectangle blocks of compressed full color but maybe just compressed frames of full color and and draw directly from the deflate stream will be possible.

Anyhow amazing stuff on the PokittoRemote has shown me what I want to do is possible now is just the luxury of choosing which way to do it!

In that case, maybe using LZ4 like I did here could be an option.

Nice… after some time to get up to speed with femto, mbed and c++ in general ( been a while ) I was able to get where I needed to go without even trying too hard using LZ4 + CLC Bulk handler + directDraw to the screen

Using a test 48x48x2 byte (16bit color) bitmap

  • LZ4 Compression gives ~1300 bytes for the test icon.
  • Over the serial I can draw 1000 icons to any screen location in 3.6 seconds…

Raw throughput is 1.27Mb transfer in 3.6 seconds ( ~350bytes/sec )

But due to compression that’s 48 x 48 x 1000 / 3.6 = 640K 16bit pixels per second. I think it will be even faster with a bigger bitmap size but this is already more than I need. very nice.

Thanks FManaga… this FemtoIDE is terrific…

Question ? Does it support debugging in windows c++? I can’t seem to make it work.

3 Likes

It does, but it works better on Linux. What did you try to do? Are you trying to debug hardware using a Segger J-Link? Are you sure Windows’ firewall isn’t blocking the IDE? The tools communicate with each other over TCP and not giving them permission when the firewall pop-up appears will prevent them from working.

I also had have problems with Femto in debugging the emulator in Windows. The biggest problem is that setting the breakpoints do not work reliably. They go to the wrong lines.

I am not using the hardware debugger - would like to though… something for later.

I think it relates to this. I do get link errors and I did see the firewall message but I (think) I accepted them.

It must be getting into a funny state one way or another. When I rebooted my computer I was able to get the HelloWorld example to launch in the debugger.

I suspect at one point I launched a session and it froze in the background and this may have been blocking future sessions.

Now I know it’s supported I will keep an eye out for the correct steps to avoid the fail modes.

Thanks for the feedback.

2 Likes