Digole
Digital Solutions
iDigole Buyer ProtectioniDigole Buyer
Protection
My shopping cart
0 Items:
Secure Checkout
Top Rated Plus
Visit Our Live Auctions
99.9% Customer's Satisfaction
 
Forum : Digole Serial Display :

 Search Forum.. 
 Creat New Topic   Reply 

Custom library not working

Hey,

I'm trying to write a quick lightweight library that allows to implement the basic features of the display on a AVR atmega32u4 using arduino bootloader (same controller as an arduino leonardo).

I want to use the SPI interface, since uart is needed for some other part of my project and I2C is said to be difficult on this one.


I bought this display, it works using the demo code so there's no problem with the hardware (eg a pin that's not soldered etc). http://www.digole.com/index.php?productID=883

 

I am fairly sure the wiring is right, I'll put it here as well to be sure:
Vcc - Vcc

MOSI - Data

SCK - CLK

SS (not the one from the device, this is just a pin I assigned to this job) - SS

GND - GND

MISO on controller is left floating, tying it to ground or to MOSI doesn't change anything, except that it allows me to read my data back.

Tying SS to ground didn't change anything.


Here's the code, any thought on what could be wrong? Writing "CL" followed by "CS0" should simply clear the screen, from what I've understood, I've added CS0 in order to make sure the clear screen command is applied as said by the datasheet.

http://pastebin.com/i24MQ1hk

 

I'm not too fund of using a software SPI while I have hardware available, else I'd have copied the library more.

Cheers

RE:Custom library not working

 Few popular possible problem:

1) Not shorten the SPI jumper on the display module

2) Not pull the SCK and DATA pin to low logical level when SPI is idle

3) The SCK or DATA of SS pins from master controller is open drain, so it will not go high logical level as you want, add a pull up resister on each pin.

4) Logical Level on SS, SCK or DATA inverse

RE:Custom library not working

Hey,

 

Thanks for the suggestions.

It seems the 2nd one was right for me. Here's what seems to work now, I haven't tested it in depth yet.

// write function
void Display::write(uint8_t byte)
{
    DISP_SS_LOW;
    SPI.transfer(byte);
    PORT_SPI &= ~((1 << MOSI_PIN) | (1 << SCK_PIN));
    DISP_SS_HIGH;
}

Using SPI mode 1, frequency to be set to fck/64 (my controller runs at 16MHz).

I'll update if there's any more problem.

 

Cheers

Copyright Digole Digital Solutions, 2008-2017. All rights reserved.
Powered by Victor Sun