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

missing project files #1

Open
RudolphRiedel opened this issue Mar 21, 2022 · 166 comments
Open

missing project files #1

RudolphRiedel opened this issue Mar 21, 2022 · 166 comments

Comments

@RudolphRiedel
Copy link
Collaborator

I am trying to import this into CCS and it is missing all the project files.
Please add:
.ccsproject
.cproject
.project
And perhaps the .settings folder.

No, I have no clue what I am doing with CCS so far. :-)

@uhorkovyprivarok
Copy link
Owner

Ok sorry my bad, I have added them try now.

@RudolphRiedel
Copy link
Collaborator Author

I had to rename the dir to "BP-Displej-zaklad" in order to import the project into CCS11.
And now it does not build since somehow it can not find the device support for CC2000, more specifically it can not find DSP2833x_Device.h.
And this little exercise renews my hatred of eclipse. :-)

@RudolphRiedel
Copy link
Collaborator Author

Well, "C2000 Device Support" in version 6.3.0.0 is installed but it is not in c:ti and I have not found where it hides...

@uhorkovyprivarok
Copy link
Owner

Well I am not CCS master also because it is school project and my teacher help me with it little bit specially with CCS.. I have lessons with him Mondays at 12:00 so if you don´t move on until then he will help us on next monday xD

We have installed something on the start of the project but I can´t remember now how it was, but if I remind I will write..

I have som pics but I don´t know if it helps..

image
image

@RudolphRiedel
Copy link
Collaborator Author

I am missing this one: C:\ti\C2000Ware_4_00_00_00
Despite CCS11 is telling me that device-support is installed already.
This is this: https://www.ti.com/tool/download/C2000WARE
And it requires a login.
Well, I do have my work notebook here and I do have an account with TI thru my work...

@uhorkovyprivarok
Copy link
Owner

Well i can share that folder if it helps..

@RudolphRiedel
Copy link
Collaborator Author

I better install it and the only issue so far is to get TI to validate my account, their server is really slow right now.

@uhorkovyprivarok
Copy link
Owner

Okay.. :D I shared it already btw..

@uhorkovyprivarok
Copy link
Owner

yea and btw I only connected:
power: 27 = 5v+
30 = GND

and for SPI 4 pins:
4 = SPI_CS
6 = SPI_MOSI
7 = SPI_MISO
8 = SPI_SCK

link for datasheet: https://4dsystems.com.au/mwdownloads/download/link/id/762/

Is it enough am I right?

And the question about SPI_CS is it on pic bellow the DEN signal? so it has to be high when communicating?

image

@RudolphRiedel
Copy link
Collaborator Author

You need SPI_PD as well, so pin 2.
And that timing diagram is completely useless in this context, this is for the panel itself, so what is after the FT813.
SPI_CS is active low.

Adding the includes manually worked now, my account with TI still is not verified...
It builds now so I can have a closer look.

@uhorkovyprivarok
Copy link
Owner

Happy to hear that it worked.. Uhm I understand.. So maybe check if I have set SPI good because I set it as the diagram on the photo show.. You can also see in code that we added cs mannualy to high because the DEN confused us.. And why is there needed the SPI_PD? Isn't that only for sllep mode?

@RudolphRiedel
Copy link
Collaborator Author

SPI_PD is powerdown, I am using it for a hard reset in EVE_init().
Otherwise a software reset of the registers would be required, this is possible but not preferred.

@uhorkovyprivarok
Copy link
Owner

Uhm.. Ok I understand now..

@RudolphRiedel
Copy link
Collaborator Author

I am going over the changes you did.
First finding, replacing DELAY_MS with DELAY_US in EVE_commands.c was not necessary and implemented incorrectly, this would be a factor of 100, not 1000.

I see to pick up what you already did and modify it to the way I intended this to work.
So is GPIO14 correct for SPI_PD?

@uhorkovyprivarok
Copy link
Owner

uhm, understand about that delay.. thanks for correction..

Of course you can.. I appreciate that.. mm yes the GPIO14 is free, so it can be used as SPI_PD

@RudolphRiedel
Copy link
Collaborator Author

Time to take a break for the night, to be continued tomorrow evening.
But I can already tell that this might get ugly since it looks like that a byte in the C2000 has 16 bits.

@uhorkovyprivarok
Copy link
Owner

Yes it is.. :D
Well we will see.. The microcontroller was chosen for controlling cnc drill machine - it was the first project and now we are doing update for it so we are going to add display.. But it is harder than we thought..
Thanks a lot for today sir..

@RudolphRiedel
Copy link
Collaborator Author

Ok, I pushed files for a first test.
The EVE_xxx files are replaced with a fresh copy of the current versions.
EVE_target.h has a new target: TMS320C28XX
There is not much to go on about with the C2000 compiler, it does hardly pre-define any usefull symbols.

The mostly verbatim copies are meant to make things easier for you when I change something later on.

The new target section is to keep it portable, this is like I will release this once this works like intended.
Well, with credit and releasenotes.

I have not really looked at the function though so far.

I added a DELAY_MS() function, or rather I copied it from one of the other targets.
It does not need to be precise, it only is needed for EVE_init() and it will work as long as the time spent is not significantly less than 1ms per inner loop.

This should work for the most part:
typedef uint_least8_t uint8_t;

After this an uint8_t is 16 bits wide but I hope this is not an issue.
And I checked, a real problem would have been int8_t but there is none.
At least it builds this way.

Finally I replaced the display list commands in main.c with a EVE_init() line.

And now it would be your time to try this.
Now the more interesting question, do you have a logic analyzer at hand?
We need to check out what is happening on EVE_PDN and the SPI before we should continue.

@uhorkovyprivarok
Copy link
Owner

Hello, wow that looks great.. I will try it tomorrow, today was hard day and only thing I want to see is my favourite pajamas on me and my bed.. :D

I don't have logic analyzer at home maybe in school.. In school I have also oscilloscope.

@RudolphRiedel
Copy link
Collaborator Author

An oscilloscope is not of much use for this as the packets are a bit longer.
A cheap logic analyzer would do just fine, although at reduced SPI clock, something like this:
https://www.amazon.de/ZHITING-Analyzer-Analyzer%EF%BC%8C24MHz-USB-Kabel-kompatibel/dp/B098TGKPPZ/
Combined with Sigrok/Pulseview.
Max SPI clock would be 2MHz, maybe 4MHz but the first step is to get this to work, not make it fly. :-)

@uhorkovyprivarok
Copy link
Owner

Hello, I have photo what comes out from SPI. CS is inverted on pic, but already rewrited it right in code..
Also made small changes with my teacher.
Changes:

  • main.c :
    - cleaned-up, added empty infinite while loop
  • mcu.c, function mcu_initSpia :
    - removed FIFO settings, FIFO was not compatible with the library as library always waits for transmission to complete
    - added GPIO14 configuration as general output to control SPI_PD
    - added condition to ensure, that BRR will not overflow, so min.
    baudrate is 295 kHz
  • EVE_target.h :
    - corrected spi_transmit(uint8_t data), added a return value - see comments in file

scope_0

@uhorkovyprivarok
Copy link
Owner

tek00001

@RudolphRiedel
Copy link
Collaborator Author

This looks very promising, only the CS is going high a bit early.
Do you have the decoded MOSI / MISO values for the second image?

@RudolphRiedel
Copy link
Collaborator Author

I checked out the spi_transmit() function in EVE_target.h and had a peek into the reference manual.
And I like to suggest to do spi_transmit() a little different.

static inline void spi_transmit(uint8_t data)
{
    SpiaRegs.SPITXBUF = (data & 0xFF) << 8; /* looks odd with data = uint8_t but uint8_t actually is 16 bits wide on this controller */
    while(SpiaRegs.SPISTS.bit.INT_FLAG == 0); // wait for transmission to complete
    (void) SpiaRegs.SPIRXBUF; /* dummy read to clear the flags */
}

This is not fundamentally different, only a couple of clock-cycles faster.

while(SpiaRegs.SPISTS.bit.BUFFULL_FLAG == 1); // wait for ready state

This is not really necessary since there either was no transfer before this or the previous transfer waited for the transmission to be finished.

if(SpiaRegs.SPISTS.bit.BUFFULL_FLAG == 0) SpiaRegs.SPITXBUF = (data & 0xFF) << 8;

This is redundant in combination with the previous line, why wait for the bit to be zero and then re-check if it is zero?

(void) SpiaRegs.SPIRXBUF; /* dummy read to clear the flags */

This generates code to read the register but what is read is ignored.
So this is clearing the flags with a minimum of clock cycles.

I would like to see the the timing of the PD line after reset to check if the rough delay function is on point.
Also I would like to see the end of a transfer in more detail to make sure CS is not going high too early.

The clock could be increased, maybe use 2MHz as a start, during init it needs to be below 8MHz though.

@RudolphRiedel
Copy link
Collaborator Author

Well, a full log of the first 200ms or so after reset would be nice, from start of activity on the SPI to the end. :-)

@RudolphRiedel
Copy link
Collaborator Author

I just checked DMA in the TMS320F28xxx and the SPI unit does not support DMA.
In order to use SPI with DMA one needs to use one of the McBSP units in SPI mode.
The TMS320F28xxx really is a strange one.

@uhorkovyprivarok
Copy link
Owner

Well I will try to make photo you want, but my logic analyzer will come on friday.. the proces of initialization fail on timeout.. somehow can´t read the right ID from display.. I replaced spi_transmit, but still same problem.. ;P

Just to make sure, reading should be on 4th bit or 5th? because on the pic I sent you see that data are coming on 2nd, 3rd, 4th, but none of them are right either..

@RudolphRiedel
Copy link
Collaborator Author

This is why I asked about the decoded values from the image above. :-)

A correct sequence would look like this:
https://user-images.githubusercontent.com/31180093/103231605-7a131800-4938-11eb-80e7-1420d91e0084.png

0x30 0x21 0x2c is reading from REG_TOUCH_TAG, 0x00 is a dummy byte and with the last 0x00 the value is read.
This is an EVE_memRead8() call.
A write sequence starts with 0x80 + 22 bit address and as registers are located at 0x302000 this is usually 0xb0.

The return from the EVE chip always is 0x00 0x4a 0x43 0x43, followed by whatever data is to be read if the issued command was to read.
At the very beginning though, for the first 4x ms after powerup, there is no response at all, this is why I put annother delay in EVE_init() before reading of the chip-id starts.

@uhorkovyprivarok
Copy link
Owner

Well, I don´t have good news.. the logic analyzer that came don´t work.. I bouhgt same like you sent, but somehow the PC can´t find that logic analyzer.. I connect it but PC don´t see it.. I have been searching and found out that chinese eeprom don´t work with windows or something like that..

@RudolphRiedel
Copy link
Collaborator Author

These thing do not have a real firmware, only a ROM bootloader, the application is pushing the firmware on the device, every time.
So in this case this would be the sigrok driver.

Check with https://www.uwe-sieber.de/usbtreeview_e.html if windows at least detects the chip.

@RudolphRiedel
Copy link
Collaborator Author

Is it displaying the text?

@uhorkovyprivarok
Copy link
Owner

uhorkovyprivarok commented Apr 2, 2022

yes it is! :D

Edit: we added delay to EVE comand

@RudolphRiedel
Copy link
Collaborator Author

Yeah! :-)

@RudolphRiedel
Copy link
Collaborator Author

To EVE command?

@uhorkovyprivarok
Copy link
Owner

uhorkovyprivarok commented Apr 2, 2022

image

@RudolphRiedel
Copy link
Collaborator Author

No, no, no, no, no. :-)

@uhorkovyprivarok
Copy link
Owner

Baaaa finally.. Im so happy... :D
20220402_214151

@RudolphRiedel
Copy link
Collaborator Author

You could add it to EVE_cs_clear(void) in EVE_target.h though.

@RudolphRiedel
Copy link
Collaborator Author

Now the real fun begins. :-)

@uhorkovyprivarok
Copy link
Owner

Now the real fun begins. :-)

yeeha :D

@uhorkovyprivarok
Copy link
Owner

and how to safely power display down? just disconnect from pc?

@RudolphRiedel
Copy link
Collaborator Author

I just switch off, there is no particular power down sequence necessary.

@uhorkovyprivarok
Copy link
Owner

or how to clear display because Hello there stays there always :D

@uhorkovyprivarok
Copy link
Owner

OK.. THANKS a lot Rudolph a lot.. :D I think it is enough for today.. you can go sleep if you want.. I will sleep so sweetly.. :D I need a brake.. :D

@RudolphRiedel
Copy link
Collaborator Author

Well, you could go back and check my demo again.
But that would also require to improve the main with a basic "scheduler" in order to make the display refresh every 20ms and reading of touch every 5ms.
For the TMS320F2833x probably one of the CPU timers is to be used for the purpose of generating a system-tick.

And this was fun, I did not get to finish what I set out to do but I also did not need to finish this today. :-)

@uhorkovyprivarok
Copy link
Owner

uhorkovyprivarok commented Apr 2, 2022

Yea thanks a lot... if I can do something for you, just let me know.. :P

hmm when I write "for( int i = 0; i < 10000 ; i++ );" to EVE_cs_clear(void) in EVE_target.h display lights up, but dont see Hello there..

But when I have it like before in EVE_cmdWrite in EVE_comands it works just fine..

any idea? :D

EDIT: oh no sorry.. I didnt realised, but before writing that for cyclus I changed asm(" RPT #7 || NOP"); in spi_transmit to asm(" RPT #100 || NOP"); and that makes display work.. so "for" isnt needed..

@RudolphRiedel
Copy link
Collaborator Author

I changed asm(" RPT #7 || NOP"); in spi_transmit to asm(" RPT #100 || NOP");

Oh, heck, this is what this means, this is a delay of n+1 cycles.
So the DELAY_MS loop really does use 13 cycles, 5 for the loop and 8 for the NOP.

Looking with this at the time between the clock going low and CS going high,
an asm(" RPT #50 || NOP"); should just work, or asm(" RPT #60 || NOP"); to be on the safe side.

The one in spi_receive() still is set to #7 though and in shows in the trace, all reads end too soon.

@uhorkovyprivarok
Copy link
Owner

Yes I will correct it tomorrow, because now Im already in bed and Im already sleeping halfway.. :p

@uhorkovyprivarok
Copy link
Owner

uhorkovyprivarok commented Apr 3, 2022

changed.. uploaded, now it look pretty sweet..

EDIT: but LA still shows sometimes this so I dont know if it really ends here soon or just LA is too slow..
image

@RudolphRiedel
Copy link
Collaborator Author

I did some cleanup to prepare for release on my end, this is only missing a name to also give credit.
As I am not at all familiar with names from Slovakia, what shall I put down exactly?

And I changed it a little, I moved the 60 NOPs line to EVE_cs_clear() to not have this delay between two transfers.

You could try now to set the spi clock to max. :-)
mcu_initSpia(10000000);

This should result in 37.5MHz / 4 = 9,375MHz.

But to really test this would require some more code and most importantly a timed loop to refresh the screen every 20ms or slower.

@RudolphRiedel
Copy link
Collaborator Author

I still do not have the software package for the C2000.
But I searched the web and apparently there is a systick.c driver that utilizes CPU timer 0.

@uhorkovyprivarok
Copy link
Owner

As I am not at all familiar with names from Slovakia, what shall I put down exactly?

My name is "Dávid Sakal-Šega" but in english is not used diacritic so mby write "David Sakal-Sega" what you want.. :P

And I changed it a little, I moved the 60 NOPs line to EVE_cs_clear() to not have this delay between two transfers.

Sure.. tested it, looks, that it works good on 1 MHz.

You could try now to set the spi clock to max. :-)

Tried, but display didnt even light up.. :D and I will upload what Pulswiew showed, but I cant set frequency on pulswiew more than 12 MHz, so it looks pretty wired..

@uhorkovyprivarok
Copy link
Owner

Max SPI clock that runs is 5 MHz.. because on higher even the composer dont run trough the code.. I add pulswiew file..

@RudolphRiedel
Copy link
Collaborator Author

My name is "Dávid Sakal-Šega" but in english is not used diacritic so mby write "David Sakal-Sega" what you want.. :P

Avoiding special characters in the source code might be a good idea even though it is usually coded as UTF-8. :-)

Tried, but display didnt even light up.. :D

Well, ok, so it needs to be lower, this should be a hardware issue, from the eval board over the breakout board.
Go lower then, try 4MHz.
It might work better if you add 47R series resistors to the lines.

and I will upload what Pulswiew showed, but I cant set frequency on pulswiew more than 12 MHz, so it looks pretty wired..

Naa, I was not expecting this to display anything usefull with the cheap logic analyzer. :-)
But unless you switch to using DMA the display refresh will have an impact on how responsive the system will be overall, so the higher the clock without DMA, the better.

@RudolphRiedel
Copy link
Collaborator Author

The interesting part with the 5MHz trace is that the time between the last clock and CS high is even longer now.

@RudolphRiedel
Copy link
Collaborator Author

Ok, I uploaded EVE_target.h again with an extra line to give credit.
This maybe is a bit lame but then there were not that many contributions so far. :-)

@uhorkovyprivarok
Copy link
Owner

Today just having some fun.. :D
https://user-images.githubusercontent.com/102039070/161623497-175ff59e-b648-48f6-97f9-087b4b29b348.mp4

@uhorkovyprivarok
Copy link
Owner

uhorkovyprivarok commented May 6, 2022

Hello Rudolph, I have question is there any manual for beginners with EVE library or something like this? because a lot of files are deleted on the pages from EVE and the manual what I have is for another library that do not exist..

looking for something like this, but for EVE lib:
image

EDIT: ok never mind.. I understand that it is pretty same.. so I can use it just little bit changed names of func..

EDIT 2 : is it hard to make it touch sense (touch screen)?

@RudolphRiedel
Copy link
Collaborator Author

Hello,
and yes, I tried to keep my functions very close to the API described in FTDIs/BRTs "Programmers Guide".
However, the example you have in the image is for directly writing display lists, I do not do that and I do not recommend that.
Instead I am exclusively using the co-processor to generate the display lists.

And touch is fairly easy with EVE, check my example here:
https://github.com/RudolphRiedel/FT800-FT813/blob/5.x/examples/EVE_Test_Arduino_PlatformIO/src/tft.c

In TFT_display() I build the list and have a button:

EVE_cmd_dl_burst(TAG(10)); /* assign tag-value '10' to the button that follows /
EVE_cmd_button_burst(20,20,80,30, 28, toggle_state,"Touch!");
EVE_cmd_dl_burst(TAG(0)); /
no touch */

So all you need to do to have EVE track an object for touch events is to set a tag-value before the object.
This even works with a whole group of objects which is the reason why the very next line sets it to zero.

The touch could generate an interrupt or you could just poll the registers.
And since I never was presented with a good argument why using an interrupt would be in any way
better than just polling, I stuck to polling.
The interrupt only tells you that there is an event but not what it is.

The argument against using an interrupt is that if you implement this as an interrupt with your MCU,
you can't really read out the touch event in this interrupt since it would block the controller.
The more same way to do it would be to set a flag and read the touch event in your main loop
when the flag is set.
And at this point you can just poll for events.

My TFT_touch() function just does this and in the example I am calling it every 5ms.
I selected this value sometime ago for no apparent reason, I had to use a time based scheduler for the 20ms display-refresh anyways and I wanted a shorter base intervall than 10ms.

I have no detectable delay between touching the screen and visual feedback.

@uhorkovyprivarok
Copy link
Owner

uhorkovyprivarok commented May 6, 2022

hmm I understand a little bit, but still not sure how to make it.. can you please write easier example for me? :D I like the way you think and polling looks as good idea..

EDIT:

I am not sure if I have to refresh it like this: (of course that it is just for test.. later It will be more sensable refresh..)
(while in main)
image

and this is what test_screen looks like: (just trying to change screen when press button but nothing happens)
image

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