MicroMod Beta Testing

Sounds like you have been busy and making progress as well. Anyway's got the lib cleaned up, still more to do, and have a cleaned up sketch that allows you do do a screen capture and put it in continuous mode. Takes a little extra time since I have to convert to grayscale to color565. Am attaching if you want to play.

Good CLEANING job mjs513! :: libraries\HM01B0\examples\hm01b0_test
HM0180_ILI9341.jpg
> Works single shot and continuous!

That is The Machine learning carrier taking an "up" photo from my keyboard tray - As displayed with 2.2" :: ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, 0);
> Image from phone camera ... rotated and flipped and cropped { not sure why it needed flipped as looking now the image isn't flipped }

Took out:
Code:
  // tft.init(240, 320);           // Init ST7789 320x240

Swapped to color: ILI9341_BLACK

And fixed these to change display;
Code:
//ST7735 Adafruit 320x240 display
//#include <ILI9341_t3.h> // Hardware-specific library
//#include <ST7789_t3.h>

[B]#include "ILI9341_t3.h"
#include "font_Arial.h"

// For the Adafruit shield, these are the default.
#define TFT_DC  1
#define TFT_CS  5

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
// ILI9341_t3(uint8_t _CS, uint8_t _DC, uint8_t _RST = 255, uint8_t _MOSI=11, uint8_t _SCLK=13, uint8_t _MISO=12);
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, 0);[/B]

// ...
setup() {
  tft.begin();
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextColor(ILI9341_YELLOW);
  tft.setTextSize(2);
  tft.println("Waiting for Arduino Serial Monitor...");

Only one 3.3V - so plugged in a 2X female header with both legs soldered to hold VCC and LED.
Connected with 4" M>F ribbon cable Jumper wires
 
Here is an #ifdef update version of that sketch to select TFT_ILI9341 or TFT_ST7789
> tried to restore the ST7789 code
> removed two warnings about int and uint mismatch

View attachment hm01b0_test.ino

Also swapped 2.2" 9341 for a 2.8" PJRC 9341 and it works as well.

@KurtE - did I miss an ATP pinout to the Color Camera code? 9341 or 9488?
 
@KurtE - did I miss an ATP pinout to the Color Camera code? 9341 or 9488?

Morning all,

I have not tried it yet with ILI... Was playing with ST7789 as @mjs513 was using the ST7... and it was convenient to use the Adafruit display as I also wanted
SD card on pin 10, so just took one extra jumper wire.

I know I need to clean up the sketch...

But Camera is on same pins as the camera on the Machine Learning board:
In the OV7670.h file.
Code:
#ifdef ARDUINO_TEENSY_MICROMOD
/*
HM01B0 pin      pin#    NXP     Usage
----------      ----    ---     -----
FVLD/VSYNC      33      EMC_07  GPIO
LVLD/HSYNC      32      B0_12   FlexIO2:12
MCLK            7       B1_01   PWM
PCLK            8       B1_00   FlexIO2:16
D0              40      B0_04   FlexIO2:4
D1              41      B0_05   FlexIO2:5
D2              42      B0_06   FlexIO2:6
D3              43      B0_07   FlexIO2:7
D4              44      B0_08   FlexIO2:8  - probably not needed, use 4 bit mode
D5              45      B0_09   FlexIO2:9  - probably not needed, use 4 bit mode
D6              6       B0_10   FlexIO2:10 - probably not needed, use 4 bit mode
D7              9       B0_11   FlexIO2:11 - probably not needed, use 4 bit mode
TRIG            5       EMC_08  ???
INT             29      EMC_31  ???
SCL             19      AD_B1_0 I2C
SDA             18      AD_B1_1 I2C
*/

#define OV7670_PLK   8    //8       B1_00   FlexIO2:16
#define OV7670_XCLK  7    //7       B1_01   PWM
#define OV7670_HREF  32   //32      B0_12   FlexIO2:12
#define OV7670_VSYNC 33   //33      EMC_07  GPIO
#define OV7670_RST   30  // reset pin 

#define OV7670_D0    40   //40      B0_04   FlexIO2:4
#define OV7670_D1    41   //41      B0_05   FlexIO2:5
#define OV7670_D2    42   //42      B0_06   FlexIO2:6
#define OV7670_D3    43   //43      B0_07   FlexIO2:7
#define OV7670_D4    44   //44      B0_08   FlexIO2:8  - probably not needed, use 4 bit mode
#define OV7670_D5    45   //45      B0_09   FlexIO2:9  - probably not needed, use 4 bit mode
#define OV7670_D6    6    //6       B0_10   FlexIO2:10 - probably not needed, use 4 bit mode
#define OV7670_D7    9    //9       B0_11   FlexIO2:11 - probably not needed, use 4 bit mode
The ST7789 pins I am using on that board are:
Code:
#include <ST7735_t3.h> // Hardware-specific library
#include <ST7789_t3.h> // Hardware-specific library

// Hacked up for TeensyMM
#define TFT_MISO  12
#define TFT_MOSI  11  //a12
#define TFT_SCK   13  //a13
#define TFT_DC   34 //9 
#define TFT_CS   38 //10  
#define TFT_RST   39 //8
Note on the comments for IO pins on Camera, the FlexIO2:4 for D0 it is also GPIO 2:4 (or 7:4) depending on if you are using the High speed (7) or standard GPIO port 2 for DMA...

I reworked the DMA code yesterday as the previous code was with out the blanking PIXCLK when not HREF... So we would look at the HREF values to know if the entry that DMA returned should
be used or not. There still may be issues, but... Then there is the ILI93... code in the other CSI code that would try to setup the DMA update of the screen to try to not overlap on screen tearing... Have not tried that here either.

Need to try to setup @mjs513 later version to see how it works... But need to find enough room on desk, plus jumper wires, breadboard ...
 
@mjs513 in the process of setting up for that camera on the Machine learning... Brought down you updated version, plus @defragsters... May grab an ILI9341 display.. I noticed he used _t3 and not _t3n so can not use center or the like.

Not sure how much farther I want to take the DMA version for OV... Sort of now a proof of concept. Will see, how hard it might be to try FlexIO out here.
 
Good Morning all
@defragster - glad you got it working with the ILI9341 and its working for you.

@KurtE - haven't installed your latest updates to the ST7789 library.

Still some stuff to do but I did incorporate Sparkfun auto ae calibration function and got it working with the camera which it did not in their library. I also cleaned upped almost all the warning messages from the library. A couple left but that is associated with the BMP but still have to test that. Want to add sending the frame to the PC as well. Anyway here is the latest and greatest. Oh - I also incorporated @defragster changes to the sketch.

At some point today will push it up to github.
 

Attachments

  • HM01B0.zip
    14.8 KB · Views: 48
@mjs513 in the process of setting up for that camera on the Machine learning... Brought down you updated version, plus @defragsters... May grab an ILI9341 display.. I noticed he used _t3 and not _t3n so can not use center or the like.

Not sure how much farther I want to take the DMA version for OV... Sort of now a proof of concept. Will see, how hard it might be to try FlexIO out here.

Nice timing just updated. Use the latest - change the framerate if you want smoother video. I noticed that too but haven't got to the 9341 display yet. Want to finish changes to the lib and sketch first then play with displays.
 
It worked: picture going up from desk...
IMG_1364.jpg

Note: It took a couple of attempts to make sure I got all of the jumper wires correct, so I hacked your sketch to startup sort of like my other with, I defined more colors
Code:
#ifdef TFT_ST7789
//ST7735 Adafruit 320x240 display
#include <ST7789_t3.h>
ST7789_t3 tft = ST7789_t3(TFT_CS, TFT_DC, TFT_RST);
#define TFT_BLACK ST77XX_BLACK
#define TFT_YELLOW ST77XX_YELLOW
#define TFT_RED   ST77XX_RED
#define TFT_GREEN ST77XX_GREEN
#define TFT_BLUE  ST77XX_BLUE

#else
#include "ILI9341_t3.h"
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST);
#define TFT_BLACK ILI9341_BLACK
#define TFT_YELLOW ILI9341_YELLOW
#define TFT_RED   ILI9341_RED
#define TFT_GREEN ILI9341_GREEN
#define TFT_BLUE  ILI9341_BLUE
#endif

And added:
Code:
  tft.setRotation(1);
  tft.fillScreen(TFT_RED);
  delay(500);
  tft.fillScreen(TFT_GREEN);
  delay(500);
  tft.fillScreen(TFT_BLUE);
  delay(500);
  tft.fillScreen(TFT_BLACK);
  delay(500);
 
@KurtE
Very cool indeed. Have to add your hack :) to all my hacks in that sketch. Glad its working :)

Almost done with getting it send to processing. But need to do some other less fun things
 
No problem to change to ILI9341_t3n ... I just started with known good installed code as the HM01B0 example just used simple Rectangle to draw for the buffered image and was happy to see it working.

Will see if I can connect the camera - but not having an ST7789 will leave me wanting to use ILI9341 or an ILI9488 ? Which ever has the best support for the TFT functions in use.
 
@KurtE - @defragster
Ok need a break. Using the processing sketch in your OV7670 lib and dual USB on the TMM this is what I get for a snapshot on the PC:
Capture.PNG

Still have a little to do but here is what I have so far. Next up think I will switch displays to a ILI9341 and use your the t3n library.

EDIT: feel free to edit how I am doing the frameBuffers - using actually 3 of them.
 

Attachments

  • HM01B0.zip
    16.3 KB · Views: 80
@defragster
On my phone so... anyways they look equivalent. Both spi and 3.3v.

To run the processing sketch you need Processing app. You can get it at the Processing.org website. The processing sketch runs on the pc side
 
Okay that $15 3.3V SPI 2" ST7789 should arrive Saturday.

Thanks for the confirm. Thought that was the PC "Processing" code I've not installed yet on this machine.
 
FYI - I have mine currently setup with ILI9341 (_t3n) library so it should work fine for you. I would not suggest ILI9488 yet as lots of memory used don't have PSRAM so can not run a full Frame buffer so everything has to be converted (output 24 bits instead of 16 per pixel)...

Mike I hope you don't mind, I have been hacking on the code a little and have most of my DMA stuff from other sketch brought over and builds, but if I hit the d command, it goes BOOM...

Might be a good time for you to put on github?
 
Cool, Will move to the ili9341_t3n - is that a WIP branch or other? ... I see Master as most recent update 26 days back. :: github.com/KurtE/ILI9341_t3n

Got processing onboard to figure that out - seems to come up off and on and hadn't gone as far as getting it before.
 
Now getting grief building last github : ...\libraries\HM01B0\examples\hm01b0_test\hm01b0_test.ino

switched to :
Code:
#include "ILI9341_t3n.h"
ILI9341_t3n tft = ILI9341_t3n(TFT_CS, TFT_DC, TFT_RST);

Still building on MachL Carrier -
Code:
T:\tCode\libraries\HM01B0/HM01B0.h: In member function 'float HM01B0::fast_expf(float)':
T:\tCode\libraries\HM01B0/HM01B0.h:176:27: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   return *((float*)&packed);
                           ^
T:\tCode\libraries\HM01B0\examples\hm01b0_test\hm01b0_test.ino: In function 'void send_raw()':
T:\tCode\libraries\HM01B0\examples\hm01b0_test\hm01b0_test.ino:269:3: error: 'SerialUSB1' was not declared in this scope
[B][COLOR="#FF0000"]   SerialUSB1.write(sendImageBuf, imagesize);
[/COLOR][/B]   ^

Oh that needs to run on ATP USB_HOST? Made this edit:
Code:
#define USE_SPARKFUN 1

//#define USB_SENDRAW 1

// ...
void send_raw() {
[B]#ifdef USB_SENDRAW[/B]
  uint32_t imagesize;
  imagesize = (FRAME_WIDTH * FRAME_HEIGHT * 2);
  SerialUSB1.write(sendImageBuf, imagesize);
#endif
}

Never having used Processing - is that what the EXTRAS INO is for? That is balking as well - does it need pointer to Teensy on Serial?

Current Sketch:
Code:
[ATTACH]24388._xfImport[/ATTACH]
 
FYI - I have mine currently setup with ILI9341 (_t3n) library so it should work fine for you. I would not suggest ILI9488 yet as lots of memory used don't have PSRAM so can not run a full Frame buffer so everything has to be converted (output 24 bits instead of 16 per pixel)...

Mike I hope you don't mind, I have been hacking on the code a little and have most of my DMA stuff from other sketch brought over and builds, but if I hit the d command, it goes BOOM...

Might be a good time for you to put on github?

Ok will set up now that I am awake. :)
 
Code:
Never having used Processing - is that what the EXTRAS INO is for? That is balking as well - does it need pointer to Teensy on Serial?

The extras folder contains CameraVisualizerRayBytes.pde sketch that you run on Processing. In the main Serial Monitor you issue the 'p' command and it send the image to the processing sketch on SerialUSB1 which should show up as a second serial port. So no you don't need USB Host, just change Serial to Dual Serial.

In the processing sketch just configure your serial port which is done with one of these lines. Mine is configure for Windows and the appropriate Serial port;
Code:
  // if you know the serial port name
  myPort = new Serial(this, "COM49", 9600);                    // Windows
  //myPort = new Serial(this, "/dev/ttyACM0", 9600);            // Linux
  //myPort = new Serial(this, "/dev/cu.usbmodem14401", 9600);     // Mac
 
Thanks for the tutorial ... I wondered as the only line I saw was //mac ... the sketch was scrolled I see now :( - Opps.

Okay Dual Serial and SendRaw enabled ... Image is showing - often torn, partial and ugly though? Not a true copy?
 
@KurtE - @defragster
Just created the Github repository: TMM-HB01B0 - https://github.com/mjs513/TMM-HB01B0-Camera. Have fun.

KurtE said:
Mike I hope you don't mind, I have been hacking on the code a little and have most of my DMA stuff from other sketch brought over and builds, but if I hit the d command, it goes BOOM...
Don't mind at all. My C++ isn't all that great. Going Boom happens to me all time especially with this camera. Told you that this camera is strange - remember is only 8bits per pixel not 16.
 
RE :: Okay Dual Serial and SendRaw enabled ... Image is showing - often torn, partial and ugly though? Not a true copy?


See the fingers are not in sync ...

That's strange. I have seen that before during my development but once I fixed the bugs it was working. Assume you define Spartfun 1? Are you using the ILI9341? Have tested with that one yet :)
 
Using SFUN and 9341.

Ah - so the stored buffer data is unique to 'process'?

Other images were broken worse at times
 
Using SFUN and 9341.

Ah - so the stored buffer data is unique to 'process'?

Other images were broken worse at times

thats strange. Assume you are using the _t3n library? In middle of cleaning some stuff up with the code then will hook up a ILI9341 and see whats going on.

Maybe this will help you with my convoluted thinking:
Code:
uint8_t frameBuffer[(324) * 244];       //used to store grayscale data from the HB01B0
uint16_t imageBuffer[(324) * 244];       //used to store color565 from grayscale data which comes from the camera
uint8_t sendImageBuf[324 * 244 * 2];       //Used to store converted data from uint16 RGB to 2-bytes of RGB for sending to Processing sketch
 
Yes, changed to 9341_t3n - not sure what that does differently.

The ON SCREEN 9341 is PERFECT - that screen shot is what Processing presented.

It seems to not use current buffer but Snap another Image - maybe it is getting it not drawn sync'd or ready for use?
 
Back
Top