Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How did you compile these? #8

Open
jtannenba opened this issue Mar 8, 2024 · 23 comments
Open

How did you compile these? #8

jtannenba opened this issue Mar 8, 2024 · 23 comments

Comments

@jtannenba
Copy link

jtannenba commented Mar 8, 2024

I used arduino (ver 1.8.19) with the attiny10core forTinyOLEDdemo_t10_text. It made a text_demo.ino.{build.variant}.hex file which I loaded into the attiny10 and it doesn't do anything. tried the same with a blink program and it blinks. What did I miss?

Thank you,
Joe

@wagiminator
Copy link
Owner

I compiled it using the avr-gcc toolchain and the makefile. The firmware is not written specifically for the Arduino IDE, maybe that's why. Have you already uploaded the precompiled hex file and tried it out?

@jtannenba
Copy link
Author

Don't have the precompiled hex files. Not in the zip I downloaded. I downloaded this repository. Never did the avr-gcc toolchain. Don't think I've ever seen a tutorial to do so.

@wagiminator
Copy link
Owner

Oh yes, now I added the hex files.

@jtannenba
Copy link
Author

jtannenba commented Mar 9, 2024

I must be doing something wrong, I did find a tutorial to install the avr-gcc toolchain and compiled it. loaded it and no go
loaded your main.hed (TinyOLEDdemo_t10_text) and still no go. tried with and without 4.7K pullups on sda and scl. Pulseview shows the addresses all over the place. The programs address is correct (0x78) because my oled is 0x3c not shifted. Sorry to be a pest. I should say, I,m using a attiny10(smd) on a breakout for bread board by itself. Programming with Avrdudess and usbasp. Also may be revelant, I don't have a 128x32, I have a 128x64. Fuses of attiny10=0xFF. What should be changed to use a 128x64?

@wagiminator
Copy link
Owner

Maybe your OLED needs a different init sequence. Maybe this:

0xAE, // display off
0xD5, 0x80, // set oscillator frequency
0xA8, 0x3f, // set multiplex ratio for 128x64
0xD3, 0x00, // set display offset
0x20, 0x01, // set vertical addressing mode
0xDA, 0x02, // set COM pins to sequential
0xD9, 0xf1, // set pre-charge period
0x8D, 0x14, // enable charge pump
0xAF, // display on

with #define OLED_INIT_LEN 16

@jtannenba
Copy link
Author

jtannenba commented Mar 10, 2024

Thank you, Ill try. I'm also getting a 128x32 tomorrow. Unfortunately, didn't help. SDA looks pretty clean but SCL looks bad. Will try with a 128 x 32 tomorrow, if it comes. Didn't come, maybe Tues?

Thank you
Joe

@jtannenba
Copy link
Author

I must be losing brain cells as I age (I'm 80) I don't see how those commands (I do see a few) correlate to the datasheet. I can see turn oled on and turn it off, but not most of the double commands in the list. I did notice, coming from another program that the turn off display works. Sorry, I wish my learning mode was as when I was 20. :-(

@wagiminator
Copy link
Owner

They mainly set the control and addressing mode. It's maybe better to understand here: https://github.com/wagiminator/MCU-Templates/blob/main/Libraries/gcc/oled_term.h .

By the way, it occurred to me that it might help if you took a short break before initializing the OLED (_delay_ms(200); before OLED_init(); in line 264). Perhaps the initialization occurs too quickly after power-on.

@jtannenba
Copy link
Author

jtannenba commented Mar 11, 2024

ok, went back to original added a delay, but still nothing. Made your suggested changes and added the delay, no joy. I think I'll put this on hold till I get the 128x32 modules. Amazon is late with them.
I've been away from C programming a while. What exactly does &= ~((1<<I2C_SDA)|(1<<I2C_SCL)); (I don't recognize the operators &=, or ~ I think << means left shift.
Thank you for sticking with me.

@jtannenba
Copy link
Author

ok got one of these: https://www.amazon.com/dp/B08ZY4YBHL?psc=1&ref=ppx_yo2ov_dt_b_product_details and no joy.
tried with an attiny10 on a breakout and on a SOT23-6/SOT363 to DIP Breakout Board. Can't figure what I am doing wrong.

@wagiminator
Copy link
Owner

& means logical AND, ~means logical INVERT, | is a logical OR, << is a shift left.
&= is a logical AND of the left and the right side, the result is stored in the left side (A &= B is the same as A = A & B).

In fact, at the moment I don't know why it doesn't work. Is everything wired correctly?

@jtannenba
Copy link
Author

jtannenba commented Mar 15, 2024

Setup

This is my setup and in foreground is the same module on the breadboard and the other is the sot23-6 board with an attiny10. the cable is connected to a usbasp for programming. I did check with an Uno that the display works. I am baffled.
Pulsevie_at_powerup
Looks like it starts at 3C writing and it gets ack. Timing? Speed of mcu (how is it determined?) Fuses are 0xFF.

@wagiminator
Copy link
Owner

Soo, I dug out my old ATtiny10, connected the OLED and tried it out myself. What can I say, it didn't work (anymore) either. I also connected my logic analyzer and identified the problem. The pgm_read_byte function doesn't seem to work (anymore), only zeros are transferred instead of data. Since it definitely worked before then, it may be related to the current avr-gcc version. If I ever find the time, I'll get to the bottom of it.

@wagiminator
Copy link
Owner

init

This should actually be the init sequence...

wagiminator added a commit that referenced this issue Mar 16, 2024
@wagiminator
Copy link
Owner

So, hopefully I have solved the problem now. Try out the new version.

@jtannenba
Copy link
Author

jtannenba commented Mar 16, 2024

The big numbers works fine. the text is still dead? What change did you make? BTW the 128 x 64 also works fine with Big numbers.

update: Don't know what happened, but it's working now??? And now it's not?? Something is flakey-not the hookup because big numbers works every time.

Update2: started working when I put the logic analyzer on. This oled has the 4.7k resisters, but if I take the logic analyzer off, it stops working, so added 4.7k resisters on SCL and SDA and now the text is working. Close timing?

@jtannenba
Copy link
Author

Guess we should stop spending time on this. I appreciate you looking into this.
Thank you,
Joe

wagiminator added a commit that referenced this issue Mar 16, 2024
@wagiminator
Copy link
Owner

Try now, the text thing was a little too fast, I slowed it down.
The change I made was to get rid of the pgm_read_byte function.

@jtannenba
Copy link
Author

jtannenba commented Mar 16, 2024

Yep. That did it. Isn't that function in avr/pgmspace It's not in main.c.? Please excuse my ignorance. been more than 50yrs since I took a college class on C and used a lot of languages except C at work. Most of my work was in Turbo Pascal and I don't remember much from that either.

@wagiminator
Copy link
Owner

Yes, the function is from avr/pgmspace, but it seems that ATtiny10 is not supported there.

Oh yes, I remember Pascal ... and Basic of course! ;-)

@jtannenba
Copy link
Author

I did a LOT in GMAP. Assembly language for the GE 600 line computers. But all my programming was so long ago, I struggle to understand some of the programs I try to play with. I can't even remember all the languages I was trained on. Basic, Fortran IV, C, Pascal (self taught) and some AGOL. Original C (not C++) is the only program other than GMAP that I had formal instruction in. Thank you for putting up with me with this program. I am amazed at what ATMEL packed in this little ATTiny. Almost more than the large GE system I worked on.

@jtannenba
Copy link
Author

jtannenba commented Mar 25, 2024 via email

@wagiminator
Copy link
Owner

Sorry, I don't sell anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants